1

I am a java developer with 0 experience in java script. I am trying to learn angular and did tweak some projects to understand bit of angular. But I am definitely making some error in the basics. I am trying to run a hello world program in angular. I have an index.html and a controller in app.js. I am trying to call a function and show Hello {{something}} !!. I am unable to understand where I am going wrong. Please bear with me and clarify my mistake. here is the fiddle.

var myAppModule = angular.module('myModule', []);

var appController = function ($scope) {
   $scope.greeting = returnGreeting;
};

var returnGreeting = function($scope){
    return 'Hi '+$scope.name+ ' !!';
}
myAppModule.controller('appController', ['$scope',appController]);

1 Answer 1

2

You didn't initialize ng-app="" so your app is not working, also you didn't define $scope.name so it returns undefined

Here is the working link: http://jsfiddle.net/QUB4f/8/

Spend time learning JavaScript, without the knowledge of language using complex framework is not a good idea

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much. I am aware of my extraordinarily dull java script skills. I appreciate your help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.