ks2bmallik ks2bmallik - 1 year ago 96
AngularJS Question

Beginner Angular JS app, interpolation not working

I just started with Angular JS (version 1), and not been able to get the interpolation running correctly. I already checked it with solved versions, and looks fine to me. I even placed a console.log inside controller and its not printing anything. Please help.


<!doctype html>
<html lang="en" np-app="LunchCheck">
<meta charset="utf-8">
<script src="angular.min.js"></script>
<script src="app.js"></script>
<title>Lunch Checker</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
.message { font-size: 1.3em; font-weight: bold; }
<div class="container" ng-controller="LunchCheckController">
<h1>Lunch Checker</h1>
<div class="form-group">
<input id="lunch-menu" type="text"
placeholder="list comma separated dishes you usually have for lunch"
class="form-control" ng-model="food">
Content is: {{food}}


'use strict';

angular.module('LunchCheck', [])

.controller('LunchCheckController', LunchCheckController);

LunchCheckController.$inject = ['$scope'];

function LunchCheckController($scope){
console.log("In controller");
$scope.food = 'Enter something';


Answer Source

replace np-app by ng-app it will work

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download