[英]Proper way to structure a page in angular
I had an interesting discussion with one of my colleagues. 我和一位同事进行了有趣的讨论。 We are building a complex UI using angular, we have 2 different approaches
我们正在使用angular建立一个复杂的UI,我们有2种方法
I am looking for more options and/or opinions about the 2 approaches mentioned above. 我正在寻找有关上述2种方法的更多选择和/或意见。
Checkout the Angular Style guide by John Papa https://github.com/johnpapa/angular-styleguide 查看John Papa撰写的Angular Style指南https://github.com/johnpapa/angular-styleguide
This style guide contains all the best practices you need to know about AngularJS 该样式指南包含您需要了解的有关AngularJS的所有最佳实践
Since you said you build a complex UI, I would strongly recommend using the second appraoch. 由于您说过要构建复杂的UI,因此我强烈建议您使用第二种方法。 The first one has just one average: its faster to write.
第一个只有一个平均值:它的编写速度更快。 The disadventages outweigh this by far.
灾荒远远超过了这一点。 It will grow fast and you will lose track of what is happening what might lead to unsuspected behaviors.
它会快速增长,您将无法掌握正在发生的情况,而这可能导致无法预料的行为。 Its much harder to test and maintain.
它很难测试和维护。 The second approach is also better when it comes to reusability which improves code quality.
当涉及可重用性时,第二种方法也更好,它提高了代码质量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.