美文网首页我爱编程
使用 angular_cli 开发 AngularDart 应用

使用 angular_cli 开发 AngularDart 应用

作者: soojade | 来源:发表于2018-04-09 23:55 被阅读127次

安装

pub global activate angular_cli

安装完成后需要把.pub-cache/bin添加到环境变量中:

export PATH = "$HOME/.pub-cache/bin:$PATH"

更新

pub global activate angular_cli

使用

使用ngdart help查看详细命令。

创建新项目

ngdart new project_name
cd project_name
pub get
pub serve

浏览器打开 http://localhost:8080,查看结果。

生成组件

ngdart generate component AnotherComponent

lib/目录下生成如下文件:

INFO: Saving lib/another_component.dart
INFO: Saving lib/another_component.html

使用-p参数自定义目录:

ngdart generate component AnotherComponent -p lib/another

生成结果如下:

INFO: Saving lib/another/another_component.dart
INFO: Saving lib/another/another_component.html

生成测试

ngdart generate test lib/app_component.dart

会在test目录下生成两个文件:

INFO: Saving test/app_component_test.dart
INFO: Saving test/app_component_po.dart

运行命令:

pub run angular_test --test-arg=--tags=aot --test-arg=--platform=dartium  --test-arg=--reporter=expanded

使用 Dartium运行测试。

相关文章

网友评论

    本文标题:使用 angular_cli 开发 AngularDart 应用

    本文链接:https://www.haomeiwen.com/subject/mdwwhftx.html