One of the best ways to do this is to use the HTML / XHTML data- . You can write valid HTML and XHTML without having to include any angular namespace. It will be as follows:
<!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" data-ng-app=""> <head> <title>My HTML File</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular.min.js" /> </head> <body> <p>Nothing here {{'yet' + '!'}}</p> </body> </html>
This is also useful when it comes to all other angular declarations like ng-repeat and ng-show , etc.
<div ng-repeat="item in items">{{item.name}}</div> // This won't validate. <div data-ng-repeat="item in items">{{item.name}}</div> // This will validate.
Please note that your solution with downloading the angular application is also valid - but this is not really a fix for the problem you are facing. (This is just another way to download your angular application, which turned out to be ng- for your situation, since you did not have any other ng- directives in your markup.)
See a similar question and answer here.
source share