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

What wrong??

I'm already tried to do output string 'Hello ' followed a space.. So, what wrong???

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

</body>
</html>
app.js
var myApp = angular.module('myApp',[]);


myApp.controller('myController', function($scope) {
  $scope.user = {
    name: 'Hello '
  };
})

3 Answers

Henry Goh
Henry Goh
20,201 Points

Hi Ilya, Are you trying to display a name? Change your <p> tag in the HTML file to this: <p>Hello {{ user.name }}</p>

Then in your JavaScript file, $scope.name = 'Ilya';

anthony crowell
PLUS
anthony crowell
Courses Plus Student 10,953 Points

Hi sorry, so long on answering your question. I think you have the location of your js files wrong. You have angular under a /js directory and your app.js in the root directory. When you change this I believe your script will work and display "Hello". Hope this helps.

anthony crowell
PLUS
anthony crowell
Courses Plus Student 10,953 Points

Just for clarification, in your html file put them both under /js directory and make sure both the app and angular are both in there.