Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm doing railscast #405 When I runt the following, simple code, I don't get any bound content on screen.

application.html.erb

<!DOCTYPE html>
<html ng-app>

In the index, I want it to show the array of names in the .js file, and have the ability to submit a new name and have it push to the end of the list. index.html.erb

    <h1>Sizer</h1>

<div ng-controller="RafflerCtrl">
    <form ng-submit="addEntry()">
        <input type="text" ng-model="newEntry.name">
        <input type="submit" value="Add">
    </form>

    <ul>
        <li ng-repeat="entry in entries">
            {{entry.name}}
        </li>
    </ul>
</div>

Here's the code for my simple (broken) js file. sizer.js.coffee

@RafflerCtrl = ($scope)->
$scope.entries = [
 {name: "Bob"}
 {name: "Bernie"}
 {name: "Terry"}]

$scope.addEntry = ->
   $scope.entries.push($scope.newEntry)
   $scope.newEntry = {}
share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.