Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,650 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!