1

I have a simple directive like that one :

Directive js :

.directive('pageHeader', function() {
    return {
        restrict: 'E',
        scope: {
            title: '=',
            subtitle : '='
        },
        templateUrl: 'pages/templates/pageHeader.html'
    };
})

Directive html :

<div class="page-header">
    <span class="header-view-title" ng-bind="title"></span>
    <span class="header-view-subtitle" ng-bind="subtitle"></span>
</div>

And i'm using that directive like this way :

<page-header title="'The blue elephant'" subtitle="'is walking to the street'"></page-header>

There's a way to passa a filter to the 'title' and 'subtitle', and use that filter. I tried like this, but failed :

<page-header title="The blue elephant | myfilter" subtitle="is walking to the street | myfilter"></page-header>

Did someone already need do something like that ?

1 Answer 1

1

Thy this instead:

title="'The blue elephant' | myfilter"
       ^-- note quotes --^
Sign up to request clarification or add additional context in comments.

2 Comments

Without quotes Angular thinks that The blue elephant is variable, but $scope['The blue elephant'] is undefined.
I was trying with quotes around the filter too, like that : title="'The blue elephant | myfilter'", causing probably a undefined object

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.