Reputation: 154
im trying to render a custom template using the $compile but i keep getting
unrecognized expression: {{senddata}}
My code is like below
app.controller('MainCtrl', function ($scope, ngDialog,$http,$compile){
$scope.afterasset = function (selectedValues) {
$scope.senddata = 'testdata';
var data = $compile( '{{senddata}}' )( $scope );
}
}
Any idea guys ? thanks :)
Upvotes: 0
Views: 1530
Reputation: 4611
Its does't work because $compile provider need a HTML string with element tags or wraped jQlite element.
Try -
app.controller('MainCtrl', function ($scope, ngDialog,$http,$compile){
$scope.afterasset = function (selectedValues) {
$scope.senddata = 'testdata';
var data = $compile( '<p>{{senddata}}</p>' )( $scope );
}
}
Upvotes: 1