0

I am trying to bind data to the HTML page as below but data is not binding.

<body ng-app="Profileapp" ng-controller="ProfileController" >
    {{username}}
</body>

My controller is

var app = angular.module('Profileapp',['ngFlash']);
app.controller('ProfileController',['$scope','$http','$window','Flash',function($scope,$http,$window,Flash) {
    $scope.username = "sachin yadav";
}])
4
  • 1
    could you please check the console for errors? Commented Aug 7, 2017 at 14:42
  • 2
    Have you included all the dependent js files including that of ngFlash? Commented Aug 7, 2017 at 14:45
  • There is no error in console. Commented Aug 7, 2017 at 14:49
  • and i have included all files for angular Flash. Commented Aug 7, 2017 at 14:49

1 Answer 1

1

Your code is working fine. It is working fine below without the flash plugin. Check if there is any css property that is overshadowing your body. And also make sure all the dependencies for flash have been included.

var app = angular.module('Profileapp',[]);
app.controller('ProfileController',['$scope','$http','$window',function($scope,$http,$window) {
    $scope.username = "sachin yadav";
}])
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app="Profileapp" ng-controller="ProfileController" >
    {{username}}
</body>

Sign up to request clarification or add additional context in comments.

5 Comments

What error are you getting? The above snippet is working fine, it must be generated from somewhere else in your code. Check ur console if there are any errors
i tried into ejs file its working file but not in html.
What is your app engine. Is it ejs or html? I mean from backend?
was html but now i am using ejs so i changed it to ejs.
So it will work with ejs, change it back to html and check if it is working

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.