Sander, You're right and I appreciate it. In the meantime, as a beginner AngularJS learner, this is Phase 1 for me, that is, I'd like to get things to work first, especially to learn more about two way data binding (which I seem to have got a hang of it), then code-reuse with service or factory (this part, I still need to chew on), once I get comfortable with all this, then, move to Phase 2, doing much better including best practice etc.
Having said that, I'm already learning to make code more efficient with angularJS (but that's not the priority for me for the moment), for instance, for data addition, basic code for FORM inputs would look like this: $scope.frmdata.push($scope.field1, $scope.field2, $scope.field3); but now I know the following code is much better: $scope.frmdata.push($scope.contact); while the FORM looks like this: <input type="text" ng-model="contact.field1"> <input type="text" ng-model="contact.field2"> <input type="text" ng-model="contact.field3"> Many thanks. Don (Don) Chunshen Li Software Programmer On Thu, Jul 7, 2016 at 9:39 AM, Sander Elias <[email protected]> wrote: > Hi Don > > While this works, it's considered bad practice. Accessing the DOM directly > in a controller is creating a tight coupling between your template and your > controller. > If you want you can read all about this in the styeguide > <https://github.com/johnpapa/angular-styleguide>. > > Regards > Sander > > -- > You received this message because you are subscribed to a topic in the > Google Groups "AngularJS" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/angular/TUgbIwxFSPc/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
