1

Travellers :)

Here is an example as I think directive parameters should be working, but they don't. http://jsfiddle.net/z1m3gar5/

First directive uses

.directive('myDirective1', function () {
    return {
        restrict: 'E',
        scope: {
            options: '@'
        },
        templateUrl: 'MyDirective1.html',
        controller: function ($scope) {},
    }
})
...
<div>{{ options }}</div>

The other one uses

.directive('myDirective2', function () {
    return {
        restrict: 'E',
        scope: {
            options: '='
        },
        templateUrl: 'MyDirective2.html',
        controller: function ($scope) {},
    }
})
...
<div>{{ options.param }}</div>

First definition works just fine, the second doesn't. What do I miss? Thanks

1 Answer 1

1

You are using two-way binding for directive2 and for this you are not require to use {{ }}.

<my-directive2 options="dir2"></my-directive2>

and it will work fine!

Here is updated jsFiddle

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.