In this particular code snippet, I am encountering an issue with the $compile function. What I am trying to accomplish is taking an item, adding it to the scope, and then compiling it to generate HTML.
$http({
method: 'GET',
url : url
}).success(function(response) {
// var data = response.data;
$scope.item = preItem ;
var e = $compile('<div>{{item.name}}</div>')($scope);
});
}
Despite my best efforts to make everything static, unfortunately, the compilation process still did not work as expected.
$http({
method: 'GET',
url : url
}).success(function(response) {
$scope.tosenddata = 'testdata';
var e = $compile('<div>{{tosenddata}}</div>')($scope);
});
}
Even after tweaking various aspects, the outcome remained unchanged!
This issue arises within a controller context.