Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Foundation in ember cli application using ember.js 2.0

I am working on ember application using ember-cli.

ember version is "2.0.0-beta.2"

I am integrating the foundation 5 in application, installed bower package for foundation and also included it in ember-cli-build.js file

app.import('bower_components/foundation/js/foundation/foundation.js');
app.import('bower_components/foundation/js/foundation/foundation.offcanvas.js');

Now i want to initialize the foundation as

Ember.$(document).foundation({
  offcanvas: { close_on_click: true }
});

But in ember-2 they have removed views completely, where should i initialize it?

Any thoughts?

Thanks.

like image 426
Swati Avatar asked Nov 28 '25 23:11

Swati


1 Answers

Finally able to fix it.. Thanks to "Taras Mankovski"

Here is the solution https://github.com/embersherpa/ama/issues/8

application.hbs

{{#app-canvas}}
  <h2>Welcome to Ember.js</h2>
  {{outlet}}
{{/app-canvas}}

components/app-canvas.js

import Ember from "ember";
export default Ember.Component.extend({
  didInitAttrs() {
    Ember.run.schedule("afterRender", function() {
      Ember.$(document).foundation({
        offcanvas: { close_on_click: true }
      });
    });
  },
});
like image 171
Swati Avatar answered Dec 01 '25 13:12

Swati



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!