This is my small basic angular js code :-
var app=angular.module("myApp",[]);
app.controller("MyController",['$scope',function($scope){
$scope.name="Asim";
$scope.f1=function(){
console.log("i am clicked");
$scope.vr="lol";
}
console.log("angular working");
}]);
And this is my index.html code :-
<html ng-app="myApp">
<head>
<script type="text/javascript" src="/angular.min.js"></script>
<script src="/app.js"></script>
<title> Index </title>
</head>
<body ng-controller="MyController">
{{vr}}
{{name}}
<button ng-click="f1()">Click me</button>
</body>
</html>
When I click the button it shows in console "I am clicked" and "angular is working" does print but the {{name}} and {{vr}} doesn't print. Any possible reason??
Plus i am using nodejs and angular code is in "public" folder i.e static folder and my index.html resides in "views" formed when a project with express-generator is created. I got a hint, maybe "name" and "vr" are loaded after the index.html page is rendered, so they don't print and everything else works, ANYWAY TO FIX SUCH THING?