Angularjs Inheritance In Js


Hello everybody,

today  I want to write short notice about another useful feature of AngularJS particularly about extend function.

So, according to comment in angular.js file function extend does the following:

 * Extends the destination object `dst` by copying all of the properties from the `src` object(s)
 * to `dst`. You can specify multiple `src` objects.
 * @param {Object} dst Destination object.
 * @param {...Object} src Source object(s).
 * @returns {Object} Reference to `dst`.
function extend(dst) {
  //herer goes implementation
  return dst;

You may wonder, why do I need this? 

Well, one of the reasons, is imitiating inheritance in some way, additional modularty, but without usage of prototype. Is it useful? I believe at least for somebody it will be.

No Comments


Add a Comment


Comments are closed