javascript - AngularJS $scope always convert member instances to object -



javascript - AngularJS $scope always convert member instances to object -

i have simple code , im used organized class, services etc. problem why angular $scope changes fellow member instances object?

$scope.preparecreatecustomer = function() { $scope.customer = new customer({id:'',email:'',firstname:'',lastname:''}); alert($scope.customer instanceof customer); // returns true!** } $scope.savecustomer = function () { alert($scope.customer instanceof customer); // homecoming false!** $scope.customer = customerservice.createcustomer($scope.customer); if ($scope.customer.errormsg) { alert($scope.customer.errormsg);// gets invoke in service have logic** } else if ($scope.customer == null) { alert(null); } else { alert($scope.customer.id + " " + $scope.customer.firstname + " " +$scope.customer.lastname); } }

it puts me confusion of happen under beneath angularjs , why instances changes supertype? has angularjs directives invoking $scope?

my aim ensure argument save object check if right instance in case homecoming false in angular convert client instance object.

additional info:

javascript angularjs

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -