I have two components:
{{pc-sidebar}}
{{pc-navbar action='toggleSidebar'}}
Inside pc-navbar, i have a button that i want toggle an sidebar--active class:
<button {{action 'toggle'}}>toggle sidebar</button>
and in the pc-navbar.js, i have the following:
isOpen: true,
actions: {
toggle () {
this.toggleProperty('isOpen');
this.sendAction('action', this.get('isOpen'));
}
}
So.. the default value of sidebar is open, and when i click, i want switch for the next state.. true or false, depending on the previous state.
So.. i change the default value and send to my application controller:
actions: {
toggleSidebar (nextState) {
console.log(nextState);
}
}
Now.. how can i grap the sidebar and toggle the class?? I'm a little lost here.. Am i doing this write?
In my pc-sidebar.js i have:
export default Ember.Component.extend({
tagName: 'aside',
classNames: ['sidebar', 'sidebar--active']
});
Thank you very much!!!
Assuming you use both the components in one route say aroute
,You can have the property isOpen
in aroute
. You can pass this property to both the components, Then you can observe it in pc-sidebar
if it was modified in pc-navbar
.
I updated react-native to v0.57 and react-native run-ios is failing. I replaced babel-preset-react-native with metro-react-native-babel-preset as suggested in https://www.npmjs.com/package/babel-...
I updated react-native to v0.57 and react-native run-ios is failing. I replaced babel-preset-react-native with metro-react-native-babel-preset as suggested in https://www.npmjs.com/package/babel-...
I am trying to change text so that they happen one at a time, almost in a consecutive looking way. columns.forEach((x) => { setTimeout(() => { x.style.color="red" }, 2500) }) ...
I am trying to change text so that they happen one at a time, almost in a consecutive looking way. columns.forEach((x) => { setTimeout(() => { x.style.color="red" }, 2500) }) ...
I have a data object that looks like this: var obj = { "one": null, "two": undefined, "three": [undefined], "four": "valid value" } And I need to end up with this: {...
I have a data object that looks like this: var obj = { "one": null, "two": undefined, "three": [undefined], "four": "valid value" } And I need to end up with this: {...
This is a pretty basic question. In electron, how do I check the url/filename of a BrowserWindow? let win; app.on('ready', () => { win = new BrowserWindow(); win.loadFile(path.join(...
This is a pretty basic question. In electron, how do I check the url/filename of a BrowserWindow? let win; app.on('ready', () => { win = new BrowserWindow(); win.loadFile(path.join(...