进口无法在beta.1找到angular2 [英] Import unable to locate angular2 in beta.1
问题描述
在 AngularJS 2.0入门与Visual Studio 与alpha.28版本的作品。当我改变从
The sample code found in AngularJS 2.0 Getting Started with Visual Studio works with alpha.28 version. When I change the scripts from
<script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script>
<script src="https://jspm.io/system@0.16.js"></script>
<script src="https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js"></script>
到
<script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.src.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.1/angular2.js"></script>
我得到的,说:[本地服务器] / angular2 / angular2没有发现错误。
I get an error that says "[local server]/angular2/angular2" is not found.
自那时以来发生了什么变化?如何配置angular2要从一个CDN进口的?
What has changed since then and how do I configure angular2 to be imported from a CDN?
推荐答案
从你基本上它是导致错误app.ts其中有您的组件所在的文件。
Basically it is causing error from you app.ts file where you have your component resides.
有关导入组件
,查看
&安培; 引导
老版本的 angular2 / angular2
路径
For importing Component
, View
& bootstrap
old version has angular2/angular2
path
import {Component, View, bootstrap} from 'angular2/angular2';
大家都知道天天angular2 API迅速发生了变化。
Everyone knows day by day angular2 API has changed rapidly.
所以,按照目前的版本,你需要做的 angular2 /芯
导入组件,查看
So as per current version you need to do angular2/core
for importing Component, View
&安培; 引导
应 angular2 /平台/浏览器导入
JS
import {Component, View} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {NgFor} from 'angular2/common'; //common things are there in common module
除此之外接收
JX组件已经从 angular2.dev.js
搬走了,如果您有任何code相关的,那么你需要 Rx.js
分别在应用程式。
Other than that Rx
jx component has been moved out from angular2.dev.js
, if you have any code related then you need to include Rx.js
separately in your app.
你也需要包括 angular2-polyfills.js
&安培; ES6-shim.js
JS文件启用旧的应用程序支持。
Also you need to include angular2-polyfills.js
& es6-shim.js
js files to enable support for the older application.
这篇关于进口无法在beta.1找到angular2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!