0

I am a newbie at Angular JS and this is what I started with:

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

myApp.controller('WizardController', ['$scope', function($scope){

  $scope.user = {};
  $scope.displayName = 'Hello';

}]);

user is used to gather the data in the input fields in my steps <input type='text' ng-model='user.name'> and when I call it like so {{user.name}} what is inside the input text appears in a next step.

My question is how do I get $scope.displayName to display on my page.

<p ng-model="displayName"></p>
<p>{{displayName}}</p>
<p><input type='text' ng-model='displayName'></p>

I have tried all of these and none seem to work. Please help.

here is a jfiddle http://jsfiddle.net/Fc7KZ/

5
  • 2
    You wrote ng-modle wrong Commented May 20, 2014 at 2:18
  • they still didnt work even when i changed them to ng-model Commented May 20, 2014 at 2:21
  • please provide a jsfiddle or plunker demo to review Commented May 20, 2014 at 2:24
  • jsfiddle.net/Fc7KZ Commented May 20, 2014 at 2:36
  • Updated your fiddle did not have angular library included jsfiddle.net/Fc7KZ/2 Commented May 20, 2014 at 2:56

2 Answers 2

2

Make sure you added the ng-app and ng-controller attributes to your html

<body ng-app="myApp" ng-controller="WizardController">
<p ng-model="displayName"></p>
<p>{{displayName}}</p>
<p><input type='text' ng-model='displayName'></p>
</body>

Update 1:

Your js fiddle did not have angular library here is the version corrected:

http://jsfiddle.net/Fc7KZ/2/

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

1 Comment

nope I have those in place, but it did make me check twice.
0

You seem to be using angular-wizard. Your Fiddle doesn't include Angular or Lodash, which are both pre-requisites of that project. I'm guess your local code doesn't either, if not then that's your problem.

Comments

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.