Home  >  Q&A  >  body text

angular.js - 前端mvc的困难,angular是如何解决的呢?

困难1.操作dom的代码必须等待整个页面全部加载完成

控制器不操作dom,dom操作使用指令来完成,这是加载完才操作dom的保证嘛?

困难2:js的原型继承也给前端编程带来很多困难
js原型继承的痛点是什么?是 http://www.jb51.net/article/57287.htm这里所提到的子类由于和父类共享原型,导致子类修改原型的同时,父类被乱改的问题嘛?
angular 中如何规避这个痛点的?$scope在解决痛点上是否发挥了作用,发挥了什么作用?

某草草某草草2738 days ago509

reply all(1)I'll reply

  • 迷茫

    迷茫2017-05-15 17:06:26

    What I understand is: the two things you mentioned seem to have nothing to do with Angularjs.
    The controller can also operate the dom, but it is not recommended. Angularjs doesn't do anything to enforce it.
    For prototypal inheritance, it can be used or not. The main thing is to standardize the code style.

    reply
    0
  • Cancelreply