I'm currently learning Angularjs and am trying to work out why the expression in the 2nd <div>
isn't working. It's displaying:
{{ firstName1 + " " + lastName1 }}
instead of:
John1 Doe1
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
{{ firstName + " " + lastName }}
</div>
<div ng-app="myApp1" ng-controller="myCtrl1">
{{ firstName1 + " " + lastName1 }}
</div>
<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.firstName = "John";
$scope.lastName = "Doe";
});
var app1 = angular.module("myApp1", []);
app1.controller("myCtrl1", function($scope) {
$scope.firstName1 = "John1";
$scope.lastName1 = "Doe1";
});
</script>
</body>
</html>
EDIT:
To get this to work, do I need to remove ng-app="myApp1"
?
What arguments do I pass in to angular.bootstrap()
to get this to work?