使用@HostBindings在角4
问题描述:
,而不是主机我只是尽量让动画具有角4,我看到的教程,使用主机组件使用@HostBindings在角4
import { Component, OnInit, HostBinding } from '@angular/core';
import { AngularFire, AuthProviders, AuthMethods } from 'angularfire2';
import { Router } from '@angular/router';
import { moveIn } from '../router.animations';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css'],
animations: [moveIn()],
host: {'[@moveIn]': ''}
})
,但它让我看到主机属性 下错误“[tslint ]使用@hostBindings和@HostListeners而不是主机属性“
答
tslint
不是错误。它们是由tslint webpack服务创建的TypeScript linting消息。
你可以阅读更多的TSLint这里:
https://palantir.github.io/tslint/
出于某种原因,有人决定在零件以财产host
是一个不好的做法。您完全可以使用该功能以及其他组件配置功能。
要禁用此皮棉检查编辑您的tslint.json
文件,并添加/修改如下:
"use-host-property-decorator": false
将其设置为false
禁用检查。
@JGFMK他们不会被弃用。有人添加了一个tslint来标记这些,它没有任何意义。这是一个非常有效的功能。 – cgTag