Angular 将数据传递到角度指令的语法
我得到了Angular3 Dart项目的指令:Angular 将数据传递到角度指令的语法,angular,dart,angular-dart,Angular,Dart,Angular Dart,我得到了Angular3 Dart项目的指令: @Directive( selector: "[sample]", inputs: const ["text1", "text2"] ) class SampleDirective implements AfterContentInit { ... more code ... @Input("text1") String text1 = "Some Text 1"; @Input("text2") Str
@Directive(
selector: "[sample]",
inputs: const ["text1", "text2"]
)
class SampleDirective implements AfterContentInit {
... more code ...
@Input("text1") String text1 = "Some Text 1";
@Input("text2") String text2 = "Some Text 2";
}
现在,当我使用此指令时:
<a-component *sample></a-component>
知道这些表达式应该如何构造吗
@Input("sampleText1") String text1 = "Some Text 1";
或
与
需要传递一个值
<a-component *sample="'someValueForSample' text1:'TESTING' "></a-component>
然后,可以添加其他输入的赋值
或
与
需要传递一个值
<a-component *sample="'someValueForSample' text1:'TESTING' "></a-component>
然后,可以添加其他输入的值分配。
给出了ParseErrorLevel。致命:解析器错误:意外的标记:,预期的标识符,关键字,或[sample text1:'TESTING']第13列的字符串。
我确信我已经测试过了。我明天再看一看。我意识到我遗漏了这样一个变量。此外,任何辅助输入都需要以与指令相同的部分开始,因此text1:TESTING仅在我有一个名为sampleText1的输入时设置,否则它只会抛出一个致命的异常。非常好用。
给了我ParseErrorLevel。致命:解析器错误:意外的标记:,预期的标识符,关键字,或[sample text1:'TESTING']第13列的字符串。
我确信我已经测试过了。我明天再看一看。我意识到我遗漏了这样一个变量。此外,任何辅助输入都需要以与指令相同的部分开始,因此text1:TESTING仅在我有一个名为sampleText1的输入时设置,否则它只会抛出一个致命的异常。使用起来很方便。
<a-component *sample="text1:'TESTING' "></a-component>
<template sample [sampleText1]="'TESTING'">
<a-component></a-component>
</template>
@Input()
String sample;
<a-component *sample="'someValueForSample' text1:'TESTING' "></a-component>