AngularJS Scope 继承解析
AngularJS中scope之间的继承关系使用JavaScript的原型继承方式实现。本文结合AngularJSScope的实现以及相关资料谈谈原型继承机制。Scope继承实现在Angular中,想要定义一个Scope的childScope可以通过scope.$new方法实现,而$new方法本身的实现就体现了上述原型继承的思想。Angular中$new的实现类似:可以看出,如果是isolate为true,则使用Scope类型构造函数创建一个child对象。之后通过ChildScope创建的scope对象