Working mechanism about angularJS -


i starting learn angular , want overall idea of how framework created.

for example, in code snippet

<!doctype html> <html lang="en-us"> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">     </script>     <body>          <div ng-app="">              <p>name : <input type="text" ng-model="name"></p>              <h1>hello {{name}}</h1>         </div>      </body> </html> 

there usage of "{{name}}". clearly, plain html doesn't have functionality.

so angular parse whole html file know like, oh, need substitute value "name" here.

if so, won't slow down whole process (time spent on parsing , interpreting file)?

so, recommendation how understand source code appreciated.

thank you!

yes! fact <div ng-app=""> tag wraps around bit of code means angular.js gets $apply it's changes whenever page gets rendered / re-rendered. way {{name}} substituted text contents of element ng-model equal "name" within wrapper scope. tehnically angular captures dom rendering event , injects changes lets rendering continue. made possible earlier inclusion of script angular.min.jswhich initiates angular.js subsystem. hope clear.

there more in depth video here https://www.youtube.com/watch?v=fzwtsdgwgzu


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -