1

I've created an accordion based on ngResource (for live/ajax data). All works fine, however the accordion flashes (twice) on loading. How can I stop this?

This is my code (service):

AdminMenu.factory('myServices', ['$resource', function($resource) {

    return $resource('/api/categories?sort=createdAt asc');

}]);

And this is my template:

accordion(class="admin-accordion", close-others="accordion", ng-cloak)

    accordion-group(ng-repeat="category in categories", is-open="category.active", heading="{{category.name}}")

        tabset

            tab(ng-repeat="subcat in category.subcategories", heading="{{subcat.name}}", active="subcat.active", select="alertMe(category.subcategories)") {{subcat.content}}

PS: I don't know whether it could be related but within my accordion, I also have a tab using the same data as the accordion (as you can see from example above)

Any ideas?

WagnerMatosUK
  • 4,309
  • 7
  • 56
  • 95
  • What do you mean by "flashes"? Could you please provide a minimal reproduce scenario using plunker? – pkozlowski.opensource Jan 30 '14 at 09:11
  • @pkozlowski.opensource Do you know "flash on un-styled content"? That's basically it. When the page is loading and the content appears without any style. In my case, the accordion firstly appears collapsed, then closes, collapse again and the collapse again. I've used ng-cloak but it didn't seem to work. – WagnerMatosUK Jan 30 '14 at 18:49
  • @WagnerMatosUK : Put ng-cloak on the parent of the element accordion. Also check if you added the following css in your project : [ng\:cloak], [ng-cloak], [data-ng-cloak], .ng-cloak, .data-ng-cloak { display : none !important; } – Gabriel Nov 06 '14 at 10:39
  • possible duplicate of [Angular how to prevent FOUC](http://stackoverflow.com/questions/26108625/angular-how-to-prevent-fouc) – Paul Sweatte Jan 29 '15 at 16:15

0 Answers0