我正在玩Angular2而我正试图充实scala.js垫片。似乎从angular2-rc版本开始,代码不再发布到https://code.angularjs.org。最后一个版本是2.0.0-beta.17。我的<head>
标记目前包含此内容:
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.29/system.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.17/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.17/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.17/angular2.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.17/router.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.17/http.js"></script>
当然,将路径中的版本更改为任何rc版本会产生404。
如何通过脚本标记继续导入angular2库组件?我是否必须自己构建和发布它们?
答案 0 :(得分:1)
您可以从 https://npmcdn.com/@angular
获取 var ngVer = '@2.0.0-rc.4';
var routerVer = '@3.0.0-beta.1';
'@angular': 'https://npmcdn.com/@angular', // sufficient if we didn't pin the version
'@angular/router': 'https://npmcdn.com/@angular/router' + routerVer,
'@angular/forms': 'https://npmcdn.com/@angular/forms' + formsVer,
'@angular/router-deprecated': 'https://npmcdn.com/@angular/router-deprecated' + routerDeprecatedVer,
'angular2-in-memory-web-api': 'https://npmcdn.com/angular2-in-memory-web-api', // get latest
'rxjs': 'https://npmcdn.com/rxjs@5.0.0-beta.6',
'ts': 'https://npmcdn.com/plugin-typescript@4.0.10/lib/plugin.js',
'typescript': 'https://npmcdn.com/typescript@1.9.0-dev.20160409/lib/typescript.js',
请参阅此plunker示例 - https://angular.io/resources/live-examples/quickstart/ts/plnkr.html
看看这是否有帮助。