Home not getting $rootScope.updatedata from controller to html view
Reply: 0

not getting $rootScope.updatedata from controller to html view

user1558
1#
user1558 Published in June 19, 2018, 2:30 pm

I am trying to get $rootScope.updatedata from the controller to the view using $rootScope of angularjs. When I pass the data gotten from the server response to the view, the data is null. From the controller, the data has a value. Here is the snippets

app.controller("updateCtrl",["$scope","$rootScope","$location","$cookies","$http",
                            function($scope,$rootScope,$location,$cookies,$http){
    getUserDetails: function (email) {
            $http({
                method: 'GET',
                url: '/updateprofile',
                params: {email: email}
            }).then(function successCallback(response) {
                if (response.status == 204) {
                } else if (response.status == 200) {


                    alert("email24 "+response.data); //this returns an object
                    $rootScope.updatedata = response.data; //passing to the view                }
            }, function errorCallback(response) {
                alert(JSON.stringify(response));
            });
        }
    }

here is how I am getting it in the view

<input formcontrolname="firstName" value="{{updatedata.email}}" />

spring controller snippets

@RequestMapping(value = {"/updateprofile"}, method = RequestMethod.GET, headers = "Accept=application/json") 
    public ResponseData<Client> updateByEmail( @RequestParam("email") String email) {

this is my challenge

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.445077 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO