I'm new to angularjs and trying to figure out what is going on here.
I have ng-repeat:
<li class="widget flip-container" ng-repeat="widget in widgets">
<div class="widgetContent" ng-bind-html="getData(widget.UserWidgetId,widget.Url)">
</div>
</li>
getData is a function:
$scope.getData = function(id, url) {
if (url == null || url == "") return "";
return userWidgetsFactory.getWidgetHtml(url).success(function(results) {
return results;
});
};
the factory:
app.factory("userWidgetsFactory", function($http) {
var factory = {};
factory.getWidgetHtml = function(url) {
return $http.get(url);
};
return factory;
});
My problem is that the function is repeatedly called and wont stop. I know I'm doing to this so wrong.