angularjs service error [$interpolate:interr] Can't interpolate: Factory -
i writing factory/service first time , trying image factory controller getting undefined when in factory function reason.
here fiddle https://jsfiddle.net/vijay_vadlamani/2ql2lh5r/1/ html:-
js:-
angular.module('myapp').factory('imagefactory', function() { return function contentimage($scope) { $scope.getimage = function(content) { return getcontentimage(content); };
}; });
angular.module(myapp).controller('getimagectrl', ['$scope', 'imagefactory', function($scope, imagefactory) { $scope.getlistimage = function(content) { return imagefactory.getimage(content); };
}]);
try declare service this:
var app = angular.module('myapp',[]); app.factory('imagefactory', function() { var service = { getimage: function(content) { return getcontentimage(content); } }; return service });
and use this:
app.controller('getimagectrl', ['$scope','imagefactory',function($scope, imagefactory) { $scope.getlistimage = function(content) { return imagefactory.getimage(content); }; }]);
here's demo
Comments
Post a Comment