AngularDART组件
发布时间:2020-12-17 17:31:47 所属栏目:安全 来源:网络整理
导读:我在学习AngularDART组件时制作了以下简单的代码,但没有显示任何内容,任何人都可以帮助我知道我犯了什么错误: 我的html主文件: !DOCTYPE html html head link rel="stylesheet" href="bootstrap.css" link rel="stylesheet" href="main.css" titleAngularD
我在学习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文件是: < the-component>< / the-component>不工作,没有显示任何东西! 谢谢 解决方法
角度变换器从lib文件夹中选取组件.如果将组件的文件(.dart,.html,.css)放在其他文件夹(即Web)中,则需要在pubspec.yaml的transformers部分中指定它们.
例如, transformers - angular: -html_files: - absolute/path/to/your/html 希望这对你有用. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |