You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
<br>
<div ng-controller="myCtrl2">
This is 2nd Controller
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
</div>
Full Name: {{firstName + " " + lastName}}
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.firstName= "John";
$scope.lastName= "Doe";
});
app.controller('myCtrl2', function($scope) {
$scope.firstName= "John";
$scope.lastName= "Doe";
});
</script>
</body>
</html>
In this code on asking the definition of firstName in {{firstName + " " + lastName}} the plugin highlights code in MyCtrl2 instead of MyCtrl. In the AngularDefinitionQuery the scope was - "scope":{"controllers":["myCtrl2"],"props":{"lastName":"lastName","firstName":"firstName"},"module":"myApp". Instead of myCtrl2 controller the controller should be MyCtrl.
The text was updated successfully, but these errors were encountered:
sudeep30m
changed the title
Incorrect scope in Angual
Incorrect scope in Angular
Jul 7, 2017
In this code on asking the definition of firstName in {{firstName + " " + lastName}} the plugin highlights code in MyCtrl2 instead of MyCtrl. In the AngularDefinitionQuery the scope was - "scope":{"controllers":["myCtrl2"],"props":{"lastName":"lastName","firstName":"firstName"},"module":"myApp". Instead of myCtrl2 controller the controller should be MyCtrl.
The text was updated successfully, but these errors were encountered: