Comments (10)
Solved it putting this code in my controller:
init: function () {
this._super();
Ember.run.schedule("afterRender",this,function() {
$(document).foundation();
});
},
from ember-cli-foundation-6-sass.
+1
from ember-cli-foundation-6-sass.
Or, e.g. I created wrapper component for content area like this:
// app/components/application-area.js
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement() {
this._super(...arguments);
this.$().foundation();
}
});
and app/templates/components/application-area.hbs
contains just {{yield}}
from ember-cli-foundation-6-sass.
@GCheung55 @williamweckl Is this just a 2.5.x issue? have you updated to anything more recent?
from ember-cli-foundation-6-sass.
I ended up creating a wrapper component like @SlyDen's example. I don't think it was an issue with ember-cli v2.5.
I think this can be closed.
from ember-cli-foundation-6-sass.
Solved it putting this code in my controller:
Where is the controller located?
from ember-cli-foundation-6-sass.
@Jumokee I think @williamweckl was referring to a controller that corresponded to the template that had needed the Foundation JS.
So you could create an application
controller, or any of your routes can have a controller with the code.
from ember-cli-foundation-6-sass.
Thanks @williamweckl, I'm trying this in top-level application controller, and getting no luck. Ember does schedule it for afterRender, but it still seems to get called before those elements are in the DOM. Manually calling it in the console works just fine. Thoughts? Not sure why the Ember run loop isn't as intuitive as it seems... isn't afterRender a global event (as in, waits for everything to load, even children).
from ember-cli-foundation-6-sass.
Similar to @SlyDen, I just dropped a component initialize-foundation
into the top-level application template, with the following hook inside the component:
didRender: () => {
$(document).foundation();
}
This seems to work, until you render anything afterwards. You may have to do as @SlyDen does, but always wrap relevant foundation markup inside the component yield.
from ember-cli-foundation-6-sass.
As @allthesignals mentioned it won't work if you "add new HTML to the DOM" ... I faced with it recently.
I don't use addon nowadays, just raw Foundation 6.4.1. And I use only one or two Foundation's JS plugins - so I just call something like this in e.g. didInsertElement hook of my component:
Ember.run.schedule("afterRender", this, function() {
this.$().foundation();
});
Of course, it can be better solution than "afterRender" but it works without warnings ...
from ember-cli-foundation-6-sass.
Related Issues (20)
- ember-cli-foundation-6-sass don't work HOT 3
- Issues with ember 3.7
- Useless call to generator to install the dependencies
- Deprecation warning of Ember.$() in ember 3.9 HOT 12
- Fix breaking changes in FastBoot 1.0
- Foundation JS not triggered HOT 1
- Setup Travis CI and Homu HOT 6
- zf-slider component options and value HOT 4
- enabling prototype classes break sass compilation HOT 5
- zf-off-canvas does not support revealClass option. HOT 1
- Closeable Callout HOT 2
- tests fail when environment=production HOT 17
- Tests failling on ember-release channel and up
- Add appendTo option to zf-reveal.
- Top bar is broken HOT 1
- Is responsive topbar supported ? HOT 1
- Error: File to import not found or unreadable: foundation-sites/util/util (error in Ember 3.0)
- Import JavaScript modules
- Can't pass properties to zf-slider
- Can't find foundation-sites HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-cli-foundation-6-sass.