I am calling rest service in my controller to get the values like first name and last name etc but its not returning any values.
Here is my controller:
myApp.controller('profileController', function ($scope, $http) {
var url = 'rs/FetchProfile';
$http.get(url).success(function (response)
{
$scope.profiles = response;
console.log($scope.profiles); //prints nothing
}).error(function (response)
{
console.log("error", response);
});
});
The controller is not returning any values. Here is the html code where ng-controller="profileController" is declared inside LoggedIn.hmtl
<div ng-controller="profileController" >
<div ng-repeat="x in profiles" class="col-lg-4 reduce-left-margin-80">
<ul style="list-style-type: none;">
<li>First name and Last name</li>
<li>position xxxxxxx xxxxxxx</li>
<li>Company xxxxxx xxx xxxxx</li>
<li><i class="fa fa-envelope"></i> Email address</li>
</ul>
</div>
</div>
My main html page is like this:
<html lang="en" ng-app="myApp">
<head>
<title>RTH - Home page</title>
</head>
<body>
<div id="wrap">
<!--header-->
<div ui-view="header"></div>
<!--main content-->
<div ui-view="content"></div>
</div>
<!--footer-->
<div ui-view="footer"></div>
<!-- script tags here -->
</body>
</html>
And stateprovider:
$stateProvider
.state('first', {
url: "/first",
views: {
header: header,
content: {
templateUrl: 'views/HomePage.html',
controller: function ($scope) {
}
},
footer: footer
}
})
.state('LoggedIn', {
url: "/LoggedIn",
views: {
'header': header,
'content': {
temlateUrl: 'views/LoggedIn.html',
controller: function () {
}
},
'footer': footer
}
});
});
Do I have to define second state as well for my profile controller to be called?
controller: function ($scope) {}