Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript AngularJS An Introduction to Two-Way Data Binding ng-model

David Keylock
David Keylock
1,899 Points

AngularJS Challenge Task 2 of 2

Hi

I have spent hours on this task (AngularJS Task 2) and I just can't get through it... when I click 'Recheck work' I get the message 'Oops! It looks like Task 1 is no longer passing.'

If someone could please tell me where I'm going wrong I would greatly appreciate it.

Many thanks

index.html
<!DOCTYPE html>
<html ng-app="myApp">
<head>
  <title>Angular.js</title>
</head>
<body ng-controller="myController">
  <p>Hello <input ng-model= "user.name"></p>
  <script src="js/angular.js"></script>
  <script src="app.js"></script>

</body>
</html>
app.js
  angular.module('myApp', [])
    .controller('myController', ['$scope', function($scope) {
      $scope.user = {
        name: 'Alex'
      };
    }]);
Gianni Zamora
Gianni Zamora
9,547 Points

im having the sam problemo

1 Answer

Chris Shaw
Chris Shaw
26,676 Points

Hi David,

This challenge is slightly confusing as it doesn't explicitly say where to put the input field but I think the teacher assumed the question would be self explanatory, the final code you want is the below.

<p>Hello, {{user.name}}</p>
<input type="text" ng-model="user.name" />

Happy coding!

David Keylock
David Keylock
1,899 Points

That's great, many thanks Chris!