1

I'm trying to integrate AngularJs with an existing Django application. this is my first attempt with Angular.

Here is the code:

<!-- HTML (section)-->

<fieldset class="module aligned">
    <h2>Document's sections</h2>

    <div class="form-row document-nodes" ng-app="DocumentNodesApp">
        <div style="width: 100%; min-height: 450px;" ng-controller="NodeController">
            <form id="changelist-form" action="" method="post" novalidate>{% csrf_token %}
                <div id="tree"
                     data-url="{{ tree_json_url }}"
                     data-save_state="{{ app_label }}_documentnode"
                     data-auto_open="{{ tree_auto_open }}"
                     data-autoescape="{{ autoescape }}"
                >
                </div>
            </form>
            <div id="node-container">
                {$node_title$}
            </div>
        </div>
    </div>
</fieldset>



// javascript
var app = angular.module('DocumentNodesApp', []);

app.config(function($interpolateProvider) {
    $interpolateProvider.startSymbol('{$');
    $interpolateProvider.endSymbol('$}');
});

var nodeController = app.controller(
        'NodeController',
        function($scope){
            $scope.node_name = "Bla Bla bla!";
        });

What I'm doing wrong?

the variable node_title is not replaced with the value assigned. I've also tried to use the normal angular templating filters {{ }}, by sorrounding the angular variable with the django template filter verbatim, but I had the same result.

Anybody has experienced the same problems and can help me?

thanks LuKe

2
  • 1
    You haven't assigned a variable named 'node_title' - you've assigned a variable named 'node_name'... Commented Nov 11, 2014 at 15:46
  • No worries - I've added my comment as an answer :) Commented Nov 11, 2014 at 16:04

1 Answer 1

2

The variable assigned to your $scope isn't named 'node_title' - it's named 'node_name'.

Sign up to request clarification or add additional context in comments.

Comments

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.