Created
September 13, 2016 15:47
-
-
Save kaunjovi/1fd4bb942628fd2c41c88d4c5b4dd8bd to your computer and use it in GitHub Desktop.
Overriding $scope.variable by HTML, over the value set by JS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Hello world from Angular</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script> | |
</head> | |
<body> | |
<h1>Hello world from Angular</h1> | |
<div ng-app="myApp" ng-controller="myController" ng-init="message='Over written.'"> | |
<!--This message, instead of being hello world from controller, is overwritten --> | |
<h2>{{ message }} </h2> | |
</div> | |
</body> | |
<script> | |
angular.module('myApp', []) | |
.controller('myController', function( $scope ){ | |
$scope.message = 'Hello world from AngularJs.' ; | |
}) ; | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment