Open rodrigoreis22 opened 10 years ago
Does the demo application work for you?
Yes.. it works.. And the websites that uses deckgrid also works.. that's weird.
@rodrigoreis22 Do you have any updates regarding your issue?
No. For now I'm forcing the content to be "3 .column.column-1-3" if the variable is null after trying to select it from CSS.
I'm having the same problem but like @rodrigoreis22 said; the demo and other examples work. I haven't been able to implement a workaround. Also, I read the other issues and this is happening in both Chrome as well as Firefox.
Same problem here. I pretty much copied the same css files and js files as in the demo. Doesn't work in chrome but works in safari and firefox.
The demo in the docs works fine in chrome though. Can't wrap my head around this.
Same issue here in v33.0.1750.152.
By logging the getComputedStyle
content in the console, we can see that the value is fine, so it is definitely a race condition. Only in the early stage of page loading the value is not set.
I tried to put a $timeout in the Deckgrid()
instanciation, to defer execution, and it works :
$timeout(function() {
//
// The layout configuration will be parsed from
// the pseudo "before element." There you have to save all
// the column configurations.
//
self.$$scope.layout = self.$$getLayout.bind(self)();
self.$$createColumns.bind(self)();
//
// Register model change.
//
watcher = self.$$scope.$watch('model', self.$$onModelChange.bind(self), true);
self.$$watchers.push(watcher);
//
// Register media query change events.
//
angular.forEach(self.$$getMediaQueries(), function onIteration (rule) {
function onDestroy () {
rule.removeListener(self.$$onMediaQueryChange.bind(self));
}
rule.addListener(self.$$onMediaQueryChange.bind(self));
self.$$watchers.push(onDestroy);
});
});
It might be not the best place to do the defer, it just works for me now.
I just proposed a PR for anyone who wants a quick fix. Instead of bulky workwround above, i just added a timeout in the descriptor :
$timeout(function() {
return Deckgrid.create(scope, elem[0]);
}).then(function(desc) {
self.$$deckgrid = desc;
});
This is crazy, even with the timeout it breaks sometimes.
I even had to add a real delay like 100ms (as $timeout function param) in some case, it does not work without, or even with a 10ms delay...... I really cannot understand how the getComputedStyle
can be empty so many ticks after the element was added to the DOM
Edit: here are a few debug information with OSX 10.9.2 Chrome v33.0.1750.152
Content not yet ready after ms 1396020009103 // Date.now() with repetitive timeout in the directive
Content not yet ready after ms 1396020009115
Content ready after ms 1396020009127 // 24ms after first check
Followup to my previous comment:
I made a codepen to better understand the issue. It happens that getComputedStyle
for the pseudo :before
element might not be ready in specific cases, for example when element is not shown. I made a codepen to illustrate this behaviour :
I updated my PR to make is less hacky and dropped the somewhat random $timeout
in favor of a more reliable $watch
on the element. Once element ready, the watcher is discarded. Also, browser not showing this problematic behaviour will not be impacted with any delay.
Please confirm if the demonstration displays the same behaviour for your config ?
First codepen tests on OSX 10.9.2 :
On Nexus 5 Android 4.4.2 :
On iPad Retina iOS 5.1.1, and Android Opera, both codepens fail to load, i suspect an issue with codepen though.
I ended up hard cording the values i wanted in the angular-deckgrid.js file
Deckgrid.prototype.$$getLayout = function $$getLayout () {
var content = '3 .col-md-4',//$window.getComputedStyle(this.$$elem, ':before').content,
layout;
I had the same problem described above (when hidden at first, doesn't set up correctly) and @lafama 's workaround above unblocked me for the time being...
+1, having this problem too on Chrome v34.0.1847.131. Integrating @pandaiolo's domWatcher fix (pull request https://github.com/akoenig/angular-deckgrid/pull/41) does the trick for me :)
+1 having exactly the same problem. Unfortunately pull request #41 sadly doesn't help. The cards would appear when I set a breakpoint directly on the callback of domWatch
, but it never goes into its if
block when I remove the breakpoint. It seems like that window.getComputedStyle
is not ready before the entire digest cycle is over.
In the end, I tied a controller with $timeout(function(){}, 100)
on the parent element to trigger $digest
after 100ms, and it worked. (p.s. I am using @pandaiolo 's fork too)
Hey guys. I don't get it. The deckgrid is supposed to be generated by its corresponding directive. So, what's the solution to this? How can I generate the deckgrid just when the slide (I'm using Ionic's slidebox) is shown and not before?
I appreciate your soonest help.
I also have the same issue. Having deckgrid in a tab throws the No CSS configuration found
error.
Same problem here, even with the last version. It has problems working inside a modal, whereas it works fine outside.
:+1: Same issue here. I wonder if we were to have a "backup" element somewhere in the page that we can set the class to .deckgrid
and it will use that configuration if it fails it find it on the element. My issue is in a ngBootstrap modal as well.
I just had the same problem: I'm using the deckgrid inside a tab inside on modal (both angular-ui). The CSS was not found. I solved it with a little hack:
@rodrigoreis22 when I had this issue it was because I was trying to use the directive as an element. Changing <deckgrid ...>
to <div deckgrid>
solved the issue for me.
@feus4177 D'oh! Me too.
Is there any progress on this or #69 ? These have been around for a while...
I'm noticing them in Safari and iOS as well - even with <div deckgrid>
inside a set of tabs.
I have this problem on Safari as well. The "fixes" in this issue and #69 do not solve it.
EDIT: (But it does work on all other browsers, even mobile ones)
same issue in safari, please help!
firebean3's solution worked for me inside a bootstrap 3 modal in an old Angular 1.5.9 app
<div ng-init="initialised=true;"></div>
<div ng-if="initialised" deckgrid source="photos" class="deckgrid">
<div class="a-card">
<img src="" data-ng-src="{{card.src}}" width="150">
<h4>{{card.id}}</h4>
<h4>{{card.title}}</h4>
</div>
</div>
I've seen the other issues about this, but I'm still having the error:
angular-deckgrid: No CSS configuration found
Chrome version: 33.0.1750.117
My css configuration: .deckgrid[deckgrid]::before { /* Specifies that the grid should have a maximum of 4 columns. Each column will have the classes 'column' and 'column-1-4' / content: '3 .column.column-1-3'; font-size: 0; / See https://github.com/akoenig/angular-deckgrid/issues/14#issuecomment-35728861 */ visibility: hidden; }
.deckgrid .column { float: left; }
.deckgrid .column-1-3 { width: 25%; }