Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
41
rated 0 times [  47] [ 6]  / answers: 1 / hits: 46662  / 10 Years ago, tue, october 28, 2014, 12:00:00

I just now started learning on AngularJS from w3schools. I am trying to practice examples what ever they have mentioned in the tutorials. Every thing works fine but when i came to AngularJS Controllers it is not working properly as working well in w3schools Try it Yourself ». I ve forked my code into this fiddle example.
My script looks like this:



function personController($scope) {
$scope.firstName= John;
$scope.lastName= Doe;
}


Try to help me out and suggest me a good tutorial(or any free pdf file).


More From » html

 Answers
2

This is your corrected fiddle.



It is a good practice for angular that the controller definition must look something like this:



angular.module(app, []).controller(personController, function($scope) {
$scope.firstName = John;
$scope.lastName = Doe;
});


And, without doubt, the best tutorial ever for learning the basics of Angular is the CodeSchool one!



Hope this helps.


[#68991] Saturday, October 25, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
myrap

Total Points: 407
Total Questions: 105
Total Answers: 109

Location: Cambodia
Member since Thu, Oct 7, 2021
3 Years ago
myrap questions
Tue, Feb 8, 22, 00:00, 2 Years ago
Wed, Jan 15, 20, 00:00, 4 Years ago
Thu, Oct 24, 19, 00:00, 5 Years ago
Thu, Oct 3, 19, 00:00, 5 Years ago
Mon, Aug 12, 19, 00:00, 5 Years ago
;