在Angular 2中,我在TABLE TD中绑定了这样的美元值.
<td>
{{eachOutlet.dollarValue}}
</td>
Run Code Online (Sandbox Code Playgroud)
此dollarValue将小于0或等于0或大于0.当它小于零时,它应显示为"红色"颜色.当它为零时,什么都不应该出现.只是空白文本.当它大于零时,它应该使用千位分隔符并显示数字.
如何使用Angular 2绑定应用此类条件样式?它甚至可以做到吗?
我正在使用最新的'angular cli'中的 " ng lint "命令.
是否可以仅在一个打字稿文件上运行此命令,而不是在整个项目中的所有打字稿文件上运行?
谢谢亚当
我试图避免“ AntiForgery”检查,因为从第三方服务器托管时它总是失败。我正在使用ASP.NET Core 2.0 MVC应用程序。
我在ConfigureServices函数中添加了此选项:
services
.AddMvc()
.AddRazorPagesOptions( options =>
{
options.Conventions.AuthorizeFolder("/Account/Manage");
options.Conventions.AuthorizePage("/Account/Logout");
options.Conventions.ConfigureFilter(new IgnoreAntiforgeryTokenAttribute());
} );
Run Code Online (Sandbox Code Playgroud)
但是我仍然遇到这个例外。
System.InvalidOperationException:无法伪造令牌。
System.Security.Cryptography.CryptographicException:在密钥环中找不到密钥{6fb328e7-4808-4b5d-b7dc-870d126e5ca4}。
我有什么想念的吗?
我正在使用Angular4.我的打字稿文件中有一个Windows Timer订阅的observable.
this.dynamicTime = new Observable<string>((observer: Subscriber<string>) => {
setInterval(() => observer.next(this.computeTime()), 1000);
});
Run Code Online (Sandbox Code Playgroud)
在我的HTML方面,我正在使用它.
<h1>
<div>{{ dynamicTime | async }}</div>
Run Code Online (Sandbox Code Playgroud)
这非常有效.
但是,如果我将变量"dynamicTime"的类型更改Observable<string>为Observable<SomeClass>类对象.那它不起作用.有趣的是Windows计时器本身失败了.控件不会点击计时器功能"computeTime()".
这就是变化的样子.
this.dynamicTime = new Observable<SomeClass>((observer: Subscriber<SomeClass>) => {
setInterval(() => observer.next(this.computeTime()), 1000);
});
Run Code Online (Sandbox Code Playgroud)
在HTML方面,
<h1>
<div>{{ dynamicTime.someProperty | async }}</div>
Run Code Online (Sandbox Code Playgroud)
看起来HTML方面没有认识到"someProperty"."someProperty"在"SomeClass"类中声明为public.
不知道我在这里缺少什么.请指教.
谢谢亚当
angular ×3
asp.net-mvc ×1
binding ×1
conditional ×1
contextmenu ×1
lint ×1
observable ×1
styling ×1
timer ×1
typescript ×1