Angular JS : Does $scope exist without controller -
i have couple of questions in angular. since new angular can please explain below questions
what scope of variable
fnameon 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
$scopeneeded two-way binding. in above scenario$scopeexist or not, controller not created. if using$rootscopecan able add function alert or consolefnamevalue<button ng-click="alertme()">button</button>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
Post a Comment