I hope than someone could help me :) I am a little newbie in the angular directive world so I try to do something simple I have a directive inside an other directive same in Reactjs I would like pass though my value to the directive inside
this is my part of article html the templateUrl for the article Directive
<div my-title-directive
title = "Article News"
sub-title = {{subTitle}}
title-light = true
sub-title-hidden = true
section-right = {{section}}
ico = {{ico}}
ico-title-hidden = false>
</div>
<p class="anp">{{section}} - {{article}}</p>
je sub-title
and ico
one work perfectly but not the section-right
one I think it's because it's a boolean
this is my title directive
function myTitleDirective() {
return {
restrict: 'EA', //E = element, A = attribute, C = class, M = comment
scope: {
//@ reads the attribute value, = provides two-way binding, & works with functions
title : '@',
titleLight : '=',
subTitle : '@',
subTitleHidden : '=',
sectionRight : '=',
ico : '@',
icoTitleHidden : '='
},
templateUrl: 'partials/_title.html',
//controller: CategoryCtrl, //Embed a custom controller in the directive
link: function (scope, element, attrs) { } //DOM manipulation
}
};
and my article directive
function myArticleDirective (){
return {
transclude: true,
restrict: 'EA', //E = element, A = attribute, C = class, M = comment
scope: {
//@ reads the attribute value, = provides two-way binding, & works with functions
title : '@',
ico : '@',
section : '=',
subTitle : '@',
article : '@'
},
templateUrl: 'partials/_article.html',
//controller: CategoryCtrl, //Embed a custom controller in the directive
link: function (scope, element, attrs) {}
and finally my templateUrl for my title
<div class="mainTitle">
<h4 class='titleInnerSection ng-class:{ "titleLight" : !titleLight }'>{{title}} <span class='subTitleInnerSection ng-class:{ "hidden" : subTitleHidden }'>{{subTitle}}</span></h4>
</div>
<div class='categoryInnerSection ng-class:{ "hidden" : !sectionRight }'>
<div class='icoInnerSection {{"ico" + subTitle}} '><svg><use xlink:href='{{ico}}'/></svg></div>
<div class='catTitle ng-class:{ "hidden" : icoTitleHidden }'>{{subTitle}}</div>
</div>
you see what I would like to do it's just if my right section is at false I don't show it and my title directive have already this part it's the same kind of title everywhere so it's for that I would like to do a component inside a component like in React
I am sure it's simple but I don't know why the other scope variable text passing though but not a simple true false
thanks guys for your help :)