Angularjs 带隔离作用域的Angular Typescript指令在编译时生成Typescript错误
我正在使用Typescript和Angular,试图通过使用(除其他外)下面的accessible icon指令使站点更易于访问 我不知道如何在这个结构中给Angularjs 带隔离作用域的Angular Typescript指令在编译时生成Typescript错误,angularjs,typescript,isolate-scope,Angularjs,Typescript,Isolate Scope,我正在使用Typescript和Angular,试图通过使用(除其他外)下面的accessible icon指令使站点更易于访问 我不知道如何在这个结构中给name:'@'和text:'@'一个类型,我也不知道为什么TS要在scope对象中使用分号,或者在模块后使用声明 我正在实现ng.IDirective接口,因此我希望它能够处理隔离范围 有什么想法吗?谢谢 以下是angular.d.ts中的IDirective接口供参考: interface IDirective { compile
name:'@'
和text:'@'
一个类型,我也不知道为什么TS要在scope对象中使用分号,或者在模块后使用声明
我正在实现ng.IDirective接口,因此我希望它能够处理隔离范围
有什么想法吗?谢谢
以下是angular.d.ts中的IDirective接口供参考:
interface IDirective {
compile?: IDirectiveCompileFn;
controller?: any;
controllerAs?: string;
bindToController?: boolean|Object;
link?: IDirectiveLinkFn | IDirectivePrePost;
name?: string;
priority?: number;
replace?: boolean;
require?: any;
restrict?: string;
scope?: any;
template?: any;
templateNamespace?: string;
templateUrl?: any;
terminal?: boolean;
transclude?: any;
}
当您应该使用
=
时,您正在使用:
。这些应该是属性初始值设定项,而不是类型注释
module app.directives {
export class AccessibleIconDirective implements ng.IDirective {
priority = 0;
restrict = 'E';
// fixed
scope = { name: '@', text: '@'};
// fixed
template = '<i class="fa fa-{{name}}"></i><span class="invisible">{{text}}</span>';
}
}
模块应用程序指令{
导出类AccessibleConDirective实现ng.IDirective{
优先级=0;
限制='E';
//固定的
作用域={name:'@',text:'@};
//固定的
模板=“{text}}”;
}
}
当您应该使用=
时,您正在使用:
。这些应该是属性初始值设定项,而不是类型注释
module app.directives {
export class AccessibleIconDirective implements ng.IDirective {
priority = 0;
restrict = 'E';
// fixed
scope = { name: '@', text: '@'};
// fixed
template = '<i class="fa fa-{{name}}"></i><span class="invisible">{{text}}</span>';
}
}
模块应用程序指令{
导出类AccessibleConDirective实现ng.IDirective{
优先级=0;
限制='E';
//固定的
作用域={name:'@',text:'@};
//固定的
模板=“{text}}”;
}
}
我要说的是“哦!”和“谢谢”。无法看到using 3 frameworks树的林。我要说的是“哦!”和“谢谢”。无法看到using 3 frameworks树的林
module app.directives {
export class AccessibleIconDirective implements ng.IDirective {
priority = 0;
restrict = 'E';
// fixed
scope = { name: '@', text: '@'};
// fixed
template = '<i class="fa fa-{{name}}"></i><span class="invisible">{{text}}</span>';
}
}