0

I created angularjs directives:

'use strict';

angular.module('frontend')
    .directive('overall', function() {
        return {
            restrict: 'E',
            scope: {
                data: '=data'
            },
            templateUrl: 'app/components/overall/overall.html',
            controller: function($scope) {
               alert($scope.data)
            }
        };
    });

and template for him:

<div id="inner-overall">
  Taras
</div>

After it in other page I use my directive like this:

<overall data></overall>

and js code:

$scope.data = 'daadad';

But it is not working, and I catch empty $scope.data value. I don't know why it happens and how to fix it, help me please with this issue. Thanks a lot!

1 Answer 1

3

You didn't bind model that's why it's empty

Try like this

<overall data="data"></overall>
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.