Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy doesn't the instantiated controller show my message?
    text
    copied!<p>In my angular HotorNot games/show.haml code this doesn't work:</p> <pre><code>.game{'ng-controller' =&gt; 'GamesCtrl as game'} %h1 Hi {{game.player}}, Is this person Hot or Not? </code></pre> <p>while this does:</p> <pre><code>.game{'ng-controller' =&gt; 'GamesCtrl as game'} %h1 Hi {{player}}, Is this person Hot or Not? </code></pre> <p>Here is my angular app and controller:</p> <pre><code>var myApp = angular.module('HotorNot', ['ngResource']); myApp.controller('GamesCtrl', ['$scope', function($scope) { $scope.player = 'Stephanie'; }]); </code></pre> <p>Why doesn't the variable "game" work here? I was trying to follow the advice I've heard to always use a . </p> <p>Update on request, generated html:</p> <pre><code>&lt;html ng-app="HotorNot" class="ng-scope"&gt;&lt;head&gt;&lt;style type="text/css"&gt;@charset "UTF-8";[ng\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\:form{display:block;}&lt;/style&gt; &lt;title&gt;AngularFun&lt;/title&gt; &lt;link href="/assets/application.css?body=1" media="all" rel="stylesheet"&gt; &lt;meta content="authenticity_token" name="csrf-param"&gt; &lt;meta content="NAKzONXDIcfeoGZxqhSn8mqFvceAQBxIxvf+lso2Ibo=" name="csrf-token"&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="game ng-scope" ng-controller="GamesCtrl as game"&gt; &lt;h1 class="ng-binding"&gt;Hi Stephanie, Is this person Hot or Not?&lt;/h1&gt; &lt;div class="voting_image"&gt; &lt;img alt="Stock footage pretty girl is listen to the music in headphones" src="http://ak1.picdn.net/shutterstock/videos/1321426/preview/stock-footage-pretty-girl-is-listen-to-the-music-in-headphones.jpg"&gt; &lt;/div&gt; &lt;button&gt;Hot&lt;/button&gt; &lt;button&gt;Not&lt;/button&gt; &lt;/div&gt; &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"&gt;&lt;/script&gt; &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular-resource.js"&gt;&lt;/script&gt; &lt;script src="/assets/app.js?body=1"&gt;&lt;/script&gt; &lt;script src="/assets/angular/controllers/games_ctrl.js?body=1"&gt;&lt;/script&gt; &lt;script src="/assets/application.js?body=1"&gt;&lt;/script&gt; &lt;/body&gt;&lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload