2

Is it possible to hide the attributes generated by Angular, like ng-app, ng-init etc in the generated html? This is because I want to clean up the html that is visible to the user. In my app I am initializing ng-init with some data received from the server. This is causing the generated html to display the entire initialization data. The html does not look good.

2
  • Can't you use $scope in your controller to get the data from the server? Commented Dec 19, 2013 at 14:13
  • It's all client-side JavaScript, so it's visible to the prying eye no matter what you do. Btw, ng-init is actually a directive that should be used only for simple helper assignments, not for loading data from the server. Commented Dec 19, 2013 at 14:47

1 Answer 1

1

Do you mean the attributes within the elements in the source?

To make those valid you can:

add the angular namespace to your html: <html xmlns:ng="http://angularjs.org" ng-app>

change the directives to prefix with "data-" making them valid html5 data-* attributes http://docs.angularjs.org/guide/directive

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.