0

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 ng-model 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 <body> tag has ng-app="asdf" 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>
</p>

Why isn't {{message}} interpolating onto my page?

1 Answer 1

1

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>
</div>
Sign up to request clarification or add additional context in comments.

1 Comment

I am going to cry. Don't blame me. it's almost 2am here :C That was the issue. well spotted. and thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.