如何使用angular-cli从角度构建中排除文件.我只是在tsconfig.json和tsconfig.app.json文件中添加要排除的路径,但是当我运行时ng serve,angular仍在尝试编译文件.
有任何想法吗?
有一种方法可以在管道中注入和调用服务吗?我有货币服务,我想用它来获取基于id的名称.谢谢!!
这是我的代码:
@Pipe({name: 'currencypipe', pure: false})
export class CurrencyPipe implements PipeTransform {
symbol: string = null;
constructor(private currencyService: CurrencyService) {
}
transform(value: number, currencyId: number): Promise<String> {
return this.currencyService.getCurrencie(currencyId).then(response => {
return (value + " " + response.symbol);
}
);
}
}
Run Code Online (Sandbox Code Playgroud)
我就是这样用的
{{3 | currencypipe: 2 | async}}
Run Code Online (Sandbox Code Playgroud) 当我尝试绑定像这样的异步函数时,我得到一个无限循环:
<tr *ngFor="let i of items">
<td>{{myAsyncFunc(i) | async}}</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
这是功能:
private myAsyncFunc(i: string): Promise<string> {
return Promise.resolve("some");
}
Run Code Online (Sandbox Code Playgroud)
我做错了什么?或者这是一个错误?
在 Angular 2 中,有没有办法导航和传递 URL 中未显示的数据?
我想创建一个接收复杂对象的组件,但不希望它显示在 URL 中。
谢谢!
我正在评估不同的移动框架,我认为nativescript是一个不错的选择.但我不知道开发过程是否存在局限性.例如,我对样式有限制(并不是那么重要),但我想知道将来我是否有限制并且不能使用某些本机功能或外部库.谢谢!
可以在Angular 2中创建自定义注释吗?例如注释@LoginRequired,其中它毕竟检查用户是否记录,如果是,则继续使用该组件.如果用户未登录,则导航到页面错误.
有一种方法可以更改de launch screen而无需逐个更改每个图像?就像文档说我使用的工具:http://nsimage.brosteins.com/更改图标,但要更改启动画面我必须更改20个图像,有没有最简单的方法?
我想使用Haxe导入图像,我的图像很大,但它是8位,重89kb.导入时会出现问题,因为内存大小增加了35mb.我想它是为32位图像保留内存.任何想法如何导入8位图像,而不消耗如此多的内存?
我有一个可以在 Angular 2 中工作的代码,但是当我尝试在 NativeScript 项目中使用它时失败了。\nI\xc2\xb4m 试图拒绝这样的承诺:
\n\nlogin(credentials:Credentials):Promise<User> {\n if (!valid) {\n return Promise.reject<User>("Invalid password");\n }else {\n return Promise.resolve(new User("some user"));\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n我收到此错误:
\n\nError:(32, 22) TS2346: Supplied parameters do not match any signature of call target.\nRun Code Online (Sandbox Code Playgroud)\n javascript typescript nativescript angular2-nativescript angular
angular ×6
nativescript ×3
angular-cli ×1
haxe ×1
javascript ×1
openfl ×1
pipe ×1
typescript ×1