Angular JS : Does $scope exist without controller -


i have couple of questions in angular. since new angular can please explain below questions

  1. what scope of variable fname on below code if haven't created controller

    <html> <!-- included angular js --> <body ng-app="">     <input type="text" ng-model="fname" />     <span ng-bind="fname"></span> </body> </html> 

    as per understanding $scope needed two-way binding. in above scenario $scope exist or not, controller not created. if using $rootscope can able add function alert or console fname value

    <button ng-click="alertme()">button</button> 
  2. where use expression inside angular bultin directive. have seen serveral examples in cases {{}} used inside builtin directive. e.g: ng-form="{{}}" there rule expression in directives

scopes attached dom $scope data property, , can retrieved debugging purposes

the location root scope attached dom defined location of ng-app directive.

refer https://docs.angularjs.org/guide/scope more details.

scopes allows two-way data binding, can restrict one-way.

regarding {{}}

consider javascript eval() function, when want evaluate expression, should use {{}}. evaluates expression , inserts in html.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -