Why Can't Angularjs View Send Data To This Re-usable Service?
An AngularJS app needs to re-use multiple custom objects. I am concerned about creating cluttered, redundant code that is hard to maintain, so I moved re-usable code to a service
Solution 1:
I look your plunker updated. Excellent.
Only an issue on someclass.js... you need to use "$this" variable at internal functions to access the correct scope:
$http.post('/some-test-service', funcJSON).then(
function(response) {
$this.prop2 = response.data.content;
}
);
Solution 2:
Is the form submit function correct?
I'm not sure if I fallow you guys, but if the problem is with passing form data to someclass.method1, I would try something like this:
ng-submit="someclass.method1(confirmForm.$valid,someclass.resultphone)"
instead of this:
ng-submit="someclass.method1(confirmForm.$valid)"
The someclass.method1 definition looks like
this.method1 = function(isValid, resultphone) {...}
right?
Post a Comment for "Why Can't Angularjs View Send Data To This Re-usable Service?"