Как было упомянуто выше, для ES5 следует использовать модули UMD: angular2-all.umd.js
и Rx.umd.js
. Для машинописных или ES6 используйте angular2.js
и Rx.js
(они также требуют system.js
).
В качестве учебного упражнения можно также использовать модули в стиле ES6 с ES5: (https://jsfiddle.net/8g5809rg/)
<html>
<head>
<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.13/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.13/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.13/angular2.js"></script>
<script>
System.import("angular2/core").then(function(core) {
ParentComponent.annotations = [
new core.Component({
selector: 'body',
template: '<div (click)="go()">Parent</div><child [prop1]="x"></child>',
directives: [ChildComponent]
})
];
function ParentComponent() {
this.x = "hello1"
}
ParentComponent.prototype.go = function() {
this.x += "1"
};
///
ChildComponent.annotations = [
new core.Component({
selector: 'child',
inputs: ["prop1"],
template: '<div>Child {{prop1}}</div>',
changeDetection: core.ChangeDetectionStrategy.OnPush
})
];
function ChildComponent() {
}
////////////////
System.import("angular2/platform/browser").then(function(browser) {
document.addEventListener('DOMContentLoaded', function() {
browser.bootstrap(ParentComponent);
});
});
});
</script>
</head>
<body>
</body>
</html>
https://github.com/angular/angular/blob/master/modules/angular2/docs/ bundles/overview.md –
@EricMartinez 404. Лучше разместить соответствующую информацию, чем ссылку. –