Where is the line `xmlns: ng =" http://angularjs.org "` works / needed

The recommended way to integrate angularjs into html is as follows:

<!doctype html> <html xmlns:ng="http://angularjs.org" ng-app> <body> ... <script src="angular.js"> </body> </html> 

The question is that not a single tutorial uses the xmlns:ng="http://angularjs.org" . Where is this important or meaningful? Should a string be used with every module declaration?

+5
source share
2 answers

From the documentation:

If you decide to use the ng old-style directive syntax: then include xml-namespace in html to make IE happy. (This is here for historical reasons, and we no longer recommend using ng :.)

You can see more at https://docs.angularjs.org/guide/bootstrap

+2
source

This is not for angular manual boot, it is for angular automatic boot. The xmlns namespace is optional, but probably a good practice as it identifies the HTML page using angular JS and is part of the current documentation for automatic initialization.

https://docs.angularjs.org/guide/bootstrap

At the same time, angular no longer recommends using the XML namespace to access its ng: elements (preferably ng- or data-ng-), so the namespace is actually no longer used in practice. All the same, it doesn’t hurt to leave it as an identifier.

0
source

Source: https://habr.com/ru/post/1205650/


All Articles