Here is an example of a minimal example for angularjs which works when saved as angular.html
:
One of the best ways to do this is to use the HTML/XHTML data-
attributes. You can write valid HTML and XHTML without having to include any angular namespace. This would be as follows:
My HTML File
Nothing here {{'yet' + '!'}}
This is also beneficial when it comes to all other Angular declarations, such as ng-repeat
and ng-show
, etc.
{{item.name}} // This won't validate.
{{item.name}} // This will validate.
Note that your solution with bootstrapping the Angular app is also valid - but it's not really a fix for the issue you're having. (It's simply a different way to load your Angular app, which happened to work for your situation since you didn't have any other ng-
directives in your markup.)
See a similar question and answer here.