0

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 :)

1
  • usage is correct. can you provide a plnkr Commented Nov 21, 2014 at 6:32

1 Answer 1

1

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 );
      }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.