0

some body please explain me how to get specific class name in nestloop.

<header class="secreportChartHeader">
    <span class = "secreportChartHeaderTitle">
        <div id="Global" class ="headerglobal">
            <div id="left" >log severity by Datenumber</div>
        </div>
    </span>
<header>

I would like to change 'log severity by dataenumber' : color,size,font. var header = $element[0].children[0]; // it contains the above html tags I am tried like this getting an error blocks are nested too deeply.

var chartHeader = header.getElementsByClassName('header');
for(var i=0; i<chartHeader.length; i++) {
    if(chartHeader[i].className === 'secreportChartHeaderTitle') {
        chartHeader[i].style.color = 'red';
    }
}
Jared Reeves
  • 1,390
  • 2
  • 15
  • 29
kumark
  • 91
  • 1
  • 6
  • 3
    Don't do that use ng-style, ng-class etc instead. Do you have control over `secreportChartHeaderTitle` class name on the header? – PSL Sep 29 '14 at 16:17
  • Yes it has a controller.The main goal is the graphs already drawn and now i would like to change the text color and font etc.. – kumark Sep 29 '14 at 16:26
  • Please read this http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background. – Chandermani Sep 29 '14 at 16:40
  • jQuery('#Global").addClass("someclass") will add a class to the tag with ID="Global". Nothing to do with Angular – Scott Sep 29 '14 at 17:46

1 Answers1

0

AngularJS has a small version of jQuery in it (jq Lite) that you could utilize for grabbing an element with a class name very easily with $('.secreportChartHeader')

See documentation here: https://docs.angularjs.org/api/ng/function/angular.element

From a code perspective, the main problem I see is that you are looking for an element with the class name 'header' which does not exist. If you want to grab the header element, just use the native angular element selector angular.element('header')

Hope that helps! Good Luck!

caseybaggz
  • 107
  • 1
  • 8