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 trialMichael Paccione
9,017 PointsTwo Way Data Binding AngularJS Challenge Task 1 of 2
Hi there,
I'm just starting to learn angular and the first challenge is to output Hello follow by the value stored in user.name within a paragraph tag. Thought this would work but it doesn't...
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<title>Angular.js</title>
</head>
<body>
<p ng-model="user.name">Hello {{user.name}}</p>
<script src="js/angular.js"></script>
<script src="app.js"></script>
</body>
</html>
var myApp = angular.module('myApp',[]);
.controller('myFirstController', function ($scope) {
$scope.user = {
name: "Michael"
};
});
1 Answer
Michael Paccione
9,017 PointsI just passed this but now...It makes more sense after seeing challenge task 2. Essentially this wanted me to simply link an input to a paragraph output. Fair enough I suppose you don't need any different change to the JS for that. I was imagining it pulling a predefined object value when I created the question.
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<title>Angular.js</title>
</head>
<body>
<p ng-model='user.name'>Hello {{user.name}}</p>
<script src="js/angular.js"></script>
<script src="app.js"></script>
</body>
</html>
var myApp = angular.module('myApp',[]);