0

I have a simple HTML template like following

<p>{{data.id}}</p>

And can I just compile it with a data object to a string, I do not want to bind it with any scope.

Like

var data = {id:123}; 
var result = $compile(html)(data);

Thanks!

Added Plunker here.

kdu
  • 1,259
  • 4
  • 12
  • 18
  • Your plunkr code doesn't match your question. What are you trying to do? Bind properties without a scope? Angular won't do that. Are you trying to learn how to $compile some html and add it to your page? If so, please update your question. – HankScorpio Apr 29 '15 at 16:46
  • It seems AngularJS does not support it.. I do not want scope – kdu Apr 29 '15 at 17:53
  • If you want to bind to a property, it must be on a scope. What's the problem with that? – HankScorpio Apr 29 '15 at 18:26
  • never mind. I just tried to use angular as a template generator – kdu Apr 29 '15 at 18:36

0 Answers0