Well, the official Golden Layout docs recommend using manual bootstrap, but if you want to keep using ng-app
, then you have to make sure that your components (templates) are compiled by Angular (via $compile
). Here's an example of how to do that:
angular.module('someApp') // your main module name here
.run(function ($compile, $rootScope) {
myLayout.registerComponent('template', function( container, state ){
var templateHtml = $('#' + state.templateId).html();
var compiledHtml = $compile(templateHtml)($rootScope);
container.getElement().html(compiledHtml);
});
myLayout.on( 'initialised', function() {
$rootScope.$digest(); // Golden Layout is done, let Angular know about it
});
});
// somewhere...
myLayout.init();
Basically, the main difference from the example in the repository you provided is that instead of just appending raw HTML, we $compile
it with Angular, so now it knows to set up bindings and keep the html updated.
This should allow you to keep using ng-app
instead of manual bootstrap.