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 trialGus Ba
1,913 PointsI implemented the ng-click="helloWorld()" on my save link and when I click it, it doesn't show anything in the console.
Here is my HTML:
<!doctype html> <html lang="en"> <head> <title>Gus</title> <link href='styles/main.css' rel='stylesheet' type="text/css"> </head> <body ng-app="todoListApp">
<div ng-controller="mainCtrl" class="list">
<h1>My TODOs</h1>
<input type= "checkbox"/>
<label class="editing-label">A sample todo!</label>
<input class="editing-label" type="text"/>
</div>
<div class="actions"> <a href="">Edit</a> <a href="" ng-click="helloWorld()">Save</a> <a href="" class="delete">Delete</a> </div>
<script src="scripts/angular.js" type="text/javascript"></script> <script src="scripts/app.js" type="text/javascript"></script> </body> </html>
Here is my app.js:
angular.module("todoListApp", []) .controller('mainCtrl', function($scope) { $scope.helloWorld = function() { console.log("Hello there! This is the helloWorld controller function."); }; });
1 Answer
jason chan
31,009 Pointsyour scope isn't correct. Use the ng inspector
<title>Gus</title>
<link href='styles/main.css' rel='stylesheet' type="text/css">
// nest
<div ng-controller="mainCtrl" class="list">
<h1>My TODOs</h1>
<input type= "checkbox"/>
<label class="editing-label">A sample todo!</label>
<input class="editing-label" type="text"/>
<div class="actions">
<a href="">Edit</a>
<a href="" ng-click="helloWorld()">Save</a>
<a href="" class="delete">Delete</a>
</div>
// nest
</div>
Gus Ba
1,913 PointsGus Ba
1,913 PointsThank you!
Aaron Endsley
Courses Plus Student 17,625 PointsAaron Endsley
Courses Plus Student 17,625 PointsThank you I had the same problem