Having trouble accessing the values of $scope properties after a successful $http post in index.html file. Here is the code snippet for reference, any help in resolving this issue would be greatly appreciated as I am new to AngularJs
var app = angular.module('formExample', []);
app.controller("formCtrl", ['$scope','$rootScope', '$http',
function($scope,$rootScope, $http) {
$scope.loginurl = 'loginsubmit.php';
$scope.loginFormSubmit = function(isValid) {
if (isValid) {
$http.post($scope.loginurl, {"username": $scope.username,"password": $scope.password}).
success(function(data, status) {
$scope.status = status;
$scope.data = data;
$scope.isAdmin=data.isAdmin;
$scope.username=data.username;
location.href="Index.html";
})
} else {
alert('Form is not valid');
}
}
html form code
<div class="row" ng-app="formExample" >
<div ng-controller="formCtrl">
<div class"col-md-8"> </div>
<div>username: {{$scope.username}} </div>