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 trialinfinityitsuccess
16,378 PointsWhat wrong??
I'm already tried to do output string 'Hello ' followed a space.. So, what wrong???
<!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>
var myApp = angular.module('myApp',[]);
myApp.controller('myController', function($scope) {
$scope.user = {
name: 'Hello '
};
})
3 Answers
Henry Goh
20,201 PointsHi 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
Courses Plus Student 10,953 PointsHi 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
Courses Plus Student 10,953 PointsJust for clarification, in your html file put them both under /js directory and make sure both the app and angular are both in there.