Define AngularJS directive using TypeScript and $inject mechanism

后端 未结 9 1703
死守一世寂寞
死守一世寂寞 2020-12-12 15:04

Recently I started refactoring one of the Angular projects I am working on with TypeScript. Using TypeScript classes to define controllers is very convenient and works well

9条回答
  •  粉色の甜心
    2020-12-12 15:48

    This article pretty much covers it and the answer from tanguy_k is pretty much verbatim the example given in the article. It also has all the motivation of WHY you would want to write the class this way. Inheritance, type checking and other good things...

    http://blog.aaronholmes.net/writing-angularjs-directives-as-typescript-classes/

提交回复
热议问题