[英]block ui with angular 2 on button click
Below plunker link uses angular 2 beta version code, which works perfect, 下面的代码链接使用angular 2 beta版本代码,效果很好,
<head>
<title>angular2 spinner</title>
<link rel="stylesheet" href="src/spinner.css" />
<script src="https://code.angularjs.org/2.0.0-beta.11/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/tools/typescript.js"></script>
<script src="config.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.11/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.11/angular2.min.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.11/http.min.js"></script>
<script>
System.import('app')
.catch(console.error.bind(console));
http://plnkr.co/edit/Y2ocRpbi2ORjbULrguDg?p=preview http://plnkr.co/edit/Y2ocRpbi2ORjbULrguDg?p=preview
Now I am trying to replicate the same with Angular version 2.0.X, but most of things are changed from RC version. 现在,我尝试使用Angular 2.0.X复制相同的内容,但是大多数内容已从RC版本更改。
Below is my current plunker code link, 以下是我当前的代码编码链接,
http://plnkr.co/edit/f6GBBQan7z4I9K1qBZOi?p=preview http://plnkr.co/edit/f6GBBQan7z4I9K1qBZOi?p=preview
I am very new to Angular 2, please help me to resolve it. 我是Angular 2的新手,请帮助我解决它。
Thanks, 谢谢,
I forked your plunker. 我把你的朋克分叉了。 You had some issues.
您遇到了一些问题。 As a future reference, provide necessary code in question, as links can change.
作为将来的参考,请提供有问题的必要代码,因为链接可能会更改。 Here is the plunker and I will point out errors.
这是个笨拙的人,我会指出一些错误。 Errors are also marked in plunker.
错误也会在标记中标记。 Plunker
柱塞
You had some import issues. 您遇到了一些导入问题。 When importing from angular, it should be
@angular/core
, not @angular2/core
从angular导入时,它应该是
@angular/core
,而不是@angular2/core
Providers in @Component
are not needed anymore, as you provide them @NgModule
@Component
中的提供程序不再需要,因为您提供了@NgModule
Your path was sometimes wrong in your imports of your created Component. 在导入所创建的Component时,有时路径是错误的。 You had marked them as
./src/spinner.component
, remove the src/
from the imports. 您已将它们标记为
./src/spinner.component
,从导入中删除src/
。
You were missing the entryComponents: [SpinnerComponent]
in your @NgModule
你失踪了
entryComponents: [SpinnerComponent]
在您的@NgModule
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.