我在学习AngularDART组件时制作了以下简单的代码,但没有显示任何内容,任何人都可以帮助我知道我犯了什么错误:
我的html主文件:
<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="bootstrap.css"> <link rel="stylesheet" href="main.css"> <title>AngularDART training</title> <script type="application/dart" src="main.dart"></script> <script src="packages/browser/dart.js"></script> </head> <body ng-app> <h1 id='text_id'>Welcome</h1> <the-component></the-component> </body> </html>
main.dart文件是:
import 'package:angular/angular.dart'; import 'package:angular/application_factory.dart'; @Component( selector: 'the-component',templateUrl: 'angularComponent.html',cssUrl: 'angularComponent.css',publishAs: 'cmp') class myComponent {var name = 'Component';} main() { var module = new Module() ..bind(myComponent); applicationFactory().addModule(module).run(); }
angularComponent.html文件是:
< p>这是角度:{{cmp.name}}< / p>
< the-component>< / the-component>不工作,没有显示任何东西!
谢谢