0
我有这样一个镖类写:传递变量在Angular2js /镖到HTML页面
@Component(selector: 'my-content', templateUrl: '../../views/example.html', directives: const [NgFor, NgIf, NgStyle, NgClass], pipes: const [LowerCasePipe, JoinByPipe])
class ContentComponent implements OnInit {
@Input()
ContentComponent(@Inject(ContentService) this.contentService, @Inject(LoggerService) this.log) {
}
@override
ngOnInit()
{
this.className = '.Ciao';
}
在example.html的我这样做
<span class="pull-right channel" [ngClass]="{className}">some content</span>
当我建立这个项目我收到此消息:
<span class="pull-right channel" [ERROR ->][ngClass]="{className}">some content</span>
这是正确的语法吗?
'@注入(contentService的)'和'@Inject(LoggerService)'是冗余的,如果字段具有相同的类型。 –