Charu Charu - 2 months ago 10
AngularJS Question

AngularJS Inheritance Patterns without using scope?

I am new to angular js , I am learning it through various great links and of them I came across is inheritance which shows how to get inheritance in angular js but my doubt is the author says "Since AngularJS does not provide any built-in features for using inheritance, in this blog post I’ll describe how the general JavaScript inheritance patterns can be applied to AngularJS components." but we do have scope for inheritance in angular then what does he mean by the first statement ? Am i missing something to understand ? Kindly explain.

Answer

Since AngularJS does not provide any built-in features for using inheritance

That means that angular as a framework doesn't have any mechanism for inheritance (code reuse), like, for example, backbone's extend functionality. However, you may still need to inherit functionality from controllers or services, and so the article shows you how to do that using native JS within angular framework.

we do have scope for inheritance in angular

yes, scopes do use prototypes, but it's used not share functionality (code reuse), but to enable child scopes access data from parents without additional mechanism

Comments