使用打字稿在AngularJS检查插值/ HTML中的结合 [英] Use typescript in AngularJS to check the interpolation/binding in HTML
问题描述
我知道,打字稿可以检测编译错误的* .TS文件。
然而,怎么样让在AngularJS意见/模板这些好处?举例来说,如果我有一个code,如:
< DIV NG控制器=HomeController的如家>
{{home.property1}}
< / DIV>
和我有一个HomeController类定义,那么我想收到一个编译错误,如果property1不是HomeController类定义的。
就像是可能的东西吗?
就像是可能的东西吗?
块引用>可能:是的。您将需要创建自己的HTML解析器,然后将其与打字稿编译器集成(可能使用的打字稿语言服务)。
现有:否
I know that TypeScript can detect compile errors for *.ts files.
However, what about getting these benefits in AngularJS views/templates? For example, if I have a code like:
<div ng-controller="HomeController as home"> {{home.property1}} </div>
And I have a HomeController class defined, then I'd like to receive a compile error if "property1" isn't defined for HomeController class.
Is anything like that possible?
解决方案Is anything like that possible?
Possible : Yes. You will need to create your own HTML Parser and then integrate it with the TypeScript compiler (possibly using the TypeScript language service).
Existing : No.
这篇关于使用打字稿在AngularJS检查插值/ HTML中的结合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!