admin管理员组文章数量:1296401
I'm trying to update existing angular 1 application to angular 2. I'm confused, there is nothing about controllers. What is the easiest way to migrate controllers to Angular 2?
I'm trying to update existing angular 1 application to angular 2. I'm confused, there is nothing about controllers. What is the easiest way to migrate controllers to Angular 2?
Share Improve this question asked Oct 11, 2016 at 19:26 Ulad MelekhUlad Melekh 9443 gold badges18 silver badges33 bronze badges 5- For what purpose. Don't expect stuff to be translatable 1:1. Angular2 is entirely different from Angular1. Is this about ES5/6 or TypeScript? – Günter Zöchbauer Commented Oct 11, 2016 at 19:28
- I'm moving to TS side – Ulad Melekh Commented Oct 11, 2016 at 19:30
- I don't know Angular1 well but I guess you just create a ponent, directive or service class depending on what you try to acplish. – Günter Zöchbauer Commented Oct 11, 2016 at 19:31
- As pointed in previous ments, angular2 doesn't works like angularjs (or angular1) there is no controller in this version, but I think you can implement an equivalent app just using ponents. Do you have any example of code you want to implement in angular2? – lenilsondc Commented Oct 11, 2016 at 19:37
- 4 The controller is the ponent .ts file – Eddie Martinez Commented Oct 11, 2016 at 19:37
1 Answer
Reset to default 6Angular2 is built from the ground up. Your best solution is to use Angular2 "Components".
Read more about Components at https://angular.io/api/core/Component
本文标签: javascriptEquivalent of controller in Angular 2Stack Overflow
版权声明:本文标题:javascript - Equivalent of controller in Angular 2 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741629967a2389303.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论