Krohn Krohn - 4 months ago 25
AngularJS Question

$scope variables not loading on mvc view, no errors displayed either

I am trying to set up an angular-approached MVC site to show my new boss some benefits of using it - with irony that I got stuck now.

The issue is that interpolating variables onto my view does nothing - it remains clear. I'm running in an MVC 4 environment, and sofar, just binding a

on a textbox worked, but getting a value from a controller on-load doesn't

the javascript:

var UpdateCataloguesController = function ($scope) {
$scope.message = "Hello Wurld!";

UpdateCataloguesController.$inject = ["$scope"];

asdf.controller('updateCatalogues', UpdateCataloguesController);

The html (the
tag has
on it, so omitting it here)

<input type="text" ng-model="helloAngular" ng-strict-di />
<h1>{{helloAngular}} -- THIS WORKS</h1>

<p ng-controller="updateCatalogues">
<div>{{message}} -- NOTHING BOUND HERE~</div>

Why isn't
interpolating onto my page?


You are putting a block element inside an inline element which doesn't work.

Try this:

<div ng-controller="updateCatalogues">
    <p>{{message}} -- NOTHING BOUND HERE~</p>