-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtemplate.jade
29 lines (21 loc) · 1011 Bytes
/
template.jade
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
div#myComponent
div(ng-controller="GreetingController")
p Hello, this is some "static" html
div {{greeting}}
script.
window.oc = window.oc || {};
oc.cmd = oc.cmd || [];
oc.cmd.push(function(oc){
// Ensure window.angular is available. If not, it is appended to the head first.
// If multiple oc angular components are in the page, angular will be loaded only once
// and only if it is not there already ;)
oc.require('angular', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.js', function (angular){
// Now we load our Angular controllers
oc.require('#{staticpath}js/greeting.js', function () {
// Now bootstrap Angular component's root to be recognised as app root
// This is needed to asyncronously load Angular apps - classic approach would be to add an ng-app
// on the element's root but this would make angular to error
angular.bootstrap($('#myComponent'), ["myComponentApp"]);
});
});
});