ng-class in AngularJS not working with ng-include












0














I m using a table in angularJS with ng-class for borders (Few borders appear, based on div). Code for template is below:



<table  style="border: 1px solid #ddd;" class="table container-margin table-fixed"> 
<tr>
<th style="border: 1px solid #ddd;">heading1</th>
<th style="border: 1px solid #ddd;" ng-repeat="option in options" class="hand-cursor">{{option.text}}</th>
</tr>

<tr ng-repeat="row in array">
<td ng-repeat="col in row track by $index" ng-click="(col.clickable === false) ? null : edit(col.impact, col.option, col.pers)"
ng-class="{'forTableHeading': (col.type==='tableHeading'), 'perspectiveTitle': (col.type==='perspectiveTitle'), 'shortOrLongTermValue': (col.type==='shortTermValue' || (col.type==='longTermValue')),
'fieldImpact': (!col.type&& col.field==='impact'), 'fieldDop':(!col.type && col.field==='dop'), 'fieldBlank':(!col.type && col.field==='blank')}">

<div style="white-space: pre;" ng-if="col.type==='shortTermValue'" ng-style="getBorderStyle(col.shortTermEffect)">{{col.shortTermEffect}}</div>
<div style="white-space: pre;" ng-if="col.type==='longTermValue' ng-style="getBorderStyle(col.shortTermEffect)">{{col.longTermEffect}}</div>
<div style="display:inline-block;font-style:italic;text-align:center;color:red;" ng-if="col.type==='tableHeading' " class="small">{{col.text}}</div>
<div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="col.type==='perspectiveTitle'"><b>{{col.title}}***{{description}}***</b></div>
<div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="!col.type&& col.field==='impact'">{{col.text}}</div>
<div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="!col.type && col.field==='dop'">{{col.text}}</div>
<div style="white-space: pre !important;" ng-if="!col.type && col.field==='blank'"></div>
</td>
</tr>

</table>


I have my CSS classes in own file. When I use the same table using,



<div ng-include="'aaa.tpl.html'"></div> 


However, when I use this table along with ng-include, all table borders are seen and ng-class is not working. Can someone say what am I doing wrong here?










share|improve this question
























  • Your code snippet doesn't show the entire file. I'm assuming you have a dedicated controller for aaa.tpl.html?
    – silencedogood
    Nov 21 '18 at 13:55










  • @silencedogood yes it has a dedicated controller. When I include only the ng-click and ng-class seems not working, the values in the tables are populated okay
    – user8125765
    Nov 21 '18 at 13:57
















0














I m using a table in angularJS with ng-class for borders (Few borders appear, based on div). Code for template is below:



<table  style="border: 1px solid #ddd;" class="table container-margin table-fixed"> 
<tr>
<th style="border: 1px solid #ddd;">heading1</th>
<th style="border: 1px solid #ddd;" ng-repeat="option in options" class="hand-cursor">{{option.text}}</th>
</tr>

<tr ng-repeat="row in array">
<td ng-repeat="col in row track by $index" ng-click="(col.clickable === false) ? null : edit(col.impact, col.option, col.pers)"
ng-class="{'forTableHeading': (col.type==='tableHeading'), 'perspectiveTitle': (col.type==='perspectiveTitle'), 'shortOrLongTermValue': (col.type==='shortTermValue' || (col.type==='longTermValue')),
'fieldImpact': (!col.type&& col.field==='impact'), 'fieldDop':(!col.type && col.field==='dop'), 'fieldBlank':(!col.type && col.field==='blank')}">

<div style="white-space: pre;" ng-if="col.type==='shortTermValue'" ng-style="getBorderStyle(col.shortTermEffect)">{{col.shortTermEffect}}</div>
<div style="white-space: pre;" ng-if="col.type==='longTermValue' ng-style="getBorderStyle(col.shortTermEffect)">{{col.longTermEffect}}</div>
<div style="display:inline-block;font-style:italic;text-align:center;color:red;" ng-if="col.type==='tableHeading' " class="small">{{col.text}}</div>
<div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="col.type==='perspectiveTitle'"><b>{{col.title}}***{{description}}***</b></div>
<div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="!col.type&& col.field==='impact'">{{col.text}}</div>
<div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="!col.type && col.field==='dop'">{{col.text}}</div>
<div style="white-space: pre !important;" ng-if="!col.type && col.field==='blank'"></div>
</td>
</tr>

</table>


I have my CSS classes in own file. When I use the same table using,



<div ng-include="'aaa.tpl.html'"></div> 


However, when I use this table along with ng-include, all table borders are seen and ng-class is not working. Can someone say what am I doing wrong here?










share|improve this question
























  • Your code snippet doesn't show the entire file. I'm assuming you have a dedicated controller for aaa.tpl.html?
    – silencedogood
    Nov 21 '18 at 13:55










  • @silencedogood yes it has a dedicated controller. When I include only the ng-click and ng-class seems not working, the values in the tables are populated okay
    – user8125765
    Nov 21 '18 at 13:57














0












0








0







I m using a table in angularJS with ng-class for borders (Few borders appear, based on div). Code for template is below:



<table  style="border: 1px solid #ddd;" class="table container-margin table-fixed"> 
<tr>
<th style="border: 1px solid #ddd;">heading1</th>
<th style="border: 1px solid #ddd;" ng-repeat="option in options" class="hand-cursor">{{option.text}}</th>
</tr>

<tr ng-repeat="row in array">
<td ng-repeat="col in row track by $index" ng-click="(col.clickable === false) ? null : edit(col.impact, col.option, col.pers)"
ng-class="{'forTableHeading': (col.type==='tableHeading'), 'perspectiveTitle': (col.type==='perspectiveTitle'), 'shortOrLongTermValue': (col.type==='shortTermValue' || (col.type==='longTermValue')),
'fieldImpact': (!col.type&& col.field==='impact'), 'fieldDop':(!col.type && col.field==='dop'), 'fieldBlank':(!col.type && col.field==='blank')}">

<div style="white-space: pre;" ng-if="col.type==='shortTermValue'" ng-style="getBorderStyle(col.shortTermEffect)">{{col.shortTermEffect}}</div>
<div style="white-space: pre;" ng-if="col.type==='longTermValue' ng-style="getBorderStyle(col.shortTermEffect)">{{col.longTermEffect}}</div>
<div style="display:inline-block;font-style:italic;text-align:center;color:red;" ng-if="col.type==='tableHeading' " class="small">{{col.text}}</div>
<div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="col.type==='perspectiveTitle'"><b>{{col.title}}***{{description}}***</b></div>
<div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="!col.type&& col.field==='impact'">{{col.text}}</div>
<div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="!col.type && col.field==='dop'">{{col.text}}</div>
<div style="white-space: pre !important;" ng-if="!col.type && col.field==='blank'"></div>
</td>
</tr>

</table>


I have my CSS classes in own file. When I use the same table using,



<div ng-include="'aaa.tpl.html'"></div> 


However, when I use this table along with ng-include, all table borders are seen and ng-class is not working. Can someone say what am I doing wrong here?










share|improve this question















I m using a table in angularJS with ng-class for borders (Few borders appear, based on div). Code for template is below:



<table  style="border: 1px solid #ddd;" class="table container-margin table-fixed"> 
<tr>
<th style="border: 1px solid #ddd;">heading1</th>
<th style="border: 1px solid #ddd;" ng-repeat="option in options" class="hand-cursor">{{option.text}}</th>
</tr>

<tr ng-repeat="row in array">
<td ng-repeat="col in row track by $index" ng-click="(col.clickable === false) ? null : edit(col.impact, col.option, col.pers)"
ng-class="{'forTableHeading': (col.type==='tableHeading'), 'perspectiveTitle': (col.type==='perspectiveTitle'), 'shortOrLongTermValue': (col.type==='shortTermValue' || (col.type==='longTermValue')),
'fieldImpact': (!col.type&& col.field==='impact'), 'fieldDop':(!col.type && col.field==='dop'), 'fieldBlank':(!col.type && col.field==='blank')}">

<div style="white-space: pre;" ng-if="col.type==='shortTermValue'" ng-style="getBorderStyle(col.shortTermEffect)">{{col.shortTermEffect}}</div>
<div style="white-space: pre;" ng-if="col.type==='longTermValue' ng-style="getBorderStyle(col.shortTermEffect)">{{col.longTermEffect}}</div>
<div style="display:inline-block;font-style:italic;text-align:center;color:red;" ng-if="col.type==='tableHeading' " class="small">{{col.text}}</div>
<div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="col.type==='perspectiveTitle'"><b>{{col.title}}***{{description}}***</b></div>
<div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="!col.type&& col.field==='impact'">{{col.text}}</div>
<div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="!col.type && col.field==='dop'">{{col.text}}</div>
<div style="white-space: pre !important;" ng-if="!col.type && col.field==='blank'"></div>
</td>
</tr>

</table>


I have my CSS classes in own file. When I use the same table using,



<div ng-include="'aaa.tpl.html'"></div> 


However, when I use this table along with ng-include, all table borders are seen and ng-class is not working. Can someone say what am I doing wrong here?







css angularjs ng-class






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 13:10

























asked Nov 21 '18 at 12:59









user8125765

49111




49111












  • Your code snippet doesn't show the entire file. I'm assuming you have a dedicated controller for aaa.tpl.html?
    – silencedogood
    Nov 21 '18 at 13:55










  • @silencedogood yes it has a dedicated controller. When I include only the ng-click and ng-class seems not working, the values in the tables are populated okay
    – user8125765
    Nov 21 '18 at 13:57


















  • Your code snippet doesn't show the entire file. I'm assuming you have a dedicated controller for aaa.tpl.html?
    – silencedogood
    Nov 21 '18 at 13:55










  • @silencedogood yes it has a dedicated controller. When I include only the ng-click and ng-class seems not working, the values in the tables are populated okay
    – user8125765
    Nov 21 '18 at 13:57
















Your code snippet doesn't show the entire file. I'm assuming you have a dedicated controller for aaa.tpl.html?
– silencedogood
Nov 21 '18 at 13:55




Your code snippet doesn't show the entire file. I'm assuming you have a dedicated controller for aaa.tpl.html?
– silencedogood
Nov 21 '18 at 13:55












@silencedogood yes it has a dedicated controller. When I include only the ng-click and ng-class seems not working, the values in the tables are populated okay
– user8125765
Nov 21 '18 at 13:57




@silencedogood yes it has a dedicated controller. When I include only the ng-click and ng-class seems not working, the values in the tables are populated okay
– user8125765
Nov 21 '18 at 13:57

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412593%2fng-class-in-angularjs-not-working-with-ng-include%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412593%2fng-class-in-angularjs-not-working-with-ng-include%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python