Dylan Czenski
Dylan Czenski

Reputation: 1375

Double curly braces don't work

I usually don't have this problem but for some reason I cannot make this work. I put ng-app="LunchCheck" in the body tag and when I do this

<div class="container" ng-controller="LunchCheckController">
     <h1>{{title}}</h1>

</div>

the variable title is not displaying. It is declared in the .js file, in the controller:

var LunchCheck = angular.module('LunchCheck', []);

LunchCheck.controller('LunchCheckController', 
                      LunchCheckController                     
);

LunchCheckController.$inject['$scope'];

function LunchCheckController($scope){
    $scope.title="Lunch Checker";
    $scope.count=getCount();
    $scope.message="";
    if($scope.count<=3){
        $scope.message="Enjoy!";
    }
    else $scope.message ="Too much!" ;
};

You can view the code here. Please help me with this, thank you.

Upvotes: 0

Views: 1551

Answers (1)

suvartheec
suvartheec

Reputation: 3784

Got it working: https://jsfiddle.net/suvartheec/n0jtbysz/3/

Used External Resources to load Angular and jQuery, changed body tag to

<body ng-app="LunchCheck">

Changed Load Type of Javascript to "No wrap - In Head" and commented out the script tags in the html.

Upvotes: 1

Related Questions