score:2

Accepted answer

check your angular version... i think you are using version 1.2.x and it doesn't have the merge function yet, and angular-chart.js use this function.

what you can do is use this code, put it after the angular loading, and before the chart loading...

if (!angular.merge) {
  angular.merge = (function mergepollyfill() {
    function sethashkey(obj, h) {
      if (h) {
        obj.$$hashkey = h;
      } else {
        delete obj.$$hashkey;
      }
    }

    function baseextend(dst, objs, deep) {
      var h = dst.$$hashkey;

      for (var i = 0, ii = objs.length; i < ii; ++i) {
        var obj = objs[i];
        if (!angular.isobject(obj) && !angular.isfunction(obj)) continue;
        var keys = object.keys(obj);
        for (var j = 0, jj = keys.length; j < jj; j++) {
          var key = keys[j];
          var src = obj[key];

          if (deep && angular.isobject(src)) {
            if (angular.isdate(src)) {
              dst[key] = new date(src.valueof());
            } else {
              if (!angular.isobject(dst[key])) dst[key] = angular.isarray(src) ? [] : {};
              baseextend(dst[key], [src], true);
            }
          } else {
            dst[key] = src;
          }
        }
      }

      sethashkey(dst, h);
      return dst;
    }

    return function merge(dst) {
      return baseextend(dst, [].slice.call(arguments, 1), true);
    }
  })();
}

i took it from here: deep merge objects with angularjs


Related Query

More Query from same tag