Does AngularJS support AMD like RequireJS?

前端 未结 3 1618
自闭症患者
自闭症患者 2020-12-14 17:53

In this repo AngularJS is implimented with RequireJS for AMD.

In this repo the AngularJS team seeds an AngularJS project with AMD that does not include Requ

3条回答
  •  北海茫月
    2020-12-14 18:33

    Yes, you can use RequireJS with angular. You need to do a bit of extra work to make it function, as in the link you included, but it's possible.

    In general, though, I haven't found any need for AMD with Angular. The whole idea of AMD is that it allows you to declaratively specify the dependencies between your scripts and not worry about the order in which you include them on the page. However, Angular takes care of that for you with its dependency injection mechanism, so you're not really getting any benefit by using AMD on top of that.

    tl;dr I haven't found a compelling reason to use AMD with Angular.js.

提交回复
热议问题