Reputation: 369
I try to create a simple angular app. Its logic looks like:
Enter a city name (for example: haiphong)
Click search -> There will be result showed-> Click on the result -> The map is updated to the new location -> click on the marker -> There will be an info box to show the information.
However, the direction seems to keep the expression as original. Do you have any ideas?
This is what I used to get the info box (inside controller), you can see in detail by plunker link:
$scope.getInfoBoxContent = function (index) { var content = '<div today-info-directive details="' + index +'"></div>'; var compiled = $compile(content)($scope); console.log('compiled', compiled); return compiled[0]; }
http://plnkr.co/edit/pHjqHGNupAZnO5ORSjQW?p=preview
The directive seems to include its template but not parse the expression (for example: {{1+2}})
Upvotes: 1
Views: 66
Reputation: 949
use templateUrl, remove all '\' characters copy directive template onto another file and provide it's url to templateUrl of the directive. see if it works. just tested on your fiddle and it did
Upvotes: 1