jeudi 9 février 2017

My scope always say it is undefined. I use $scope inside bunch of function which are in same controller

Vote count: 0

Following is my code which always says that $scope is undefined. Where should I use $scope. app.controller("ControllerName", function ($scope,$log,ServiceName) {

    $scope.getAll = function () 
    {
     var service = ServiceName.getAll();
            service.then(function myFunction(d) {
                $scope.Name = d.data.Abc[0].Name;
               }) 
    }
$scope.getName = function(){

 var contact = {
           ** "UserName":  $scope.Name **
        }
var getN = Service.getName(contact);
        getN.then(function (d) {
            $scope.Response = d.Response;
        },
}
)};

So, the scope near user name says that it is undefined

asked 49 secs ago

Let's block ads! (Why?)



My scope always say it is undefined. I use $scope inside bunch of function which are in same controller

Aucun commentaire:

Enregistrer un commentaire