-
-
Save GCheung55/e7951c16334b68566eda14f55147f80d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//app/components/marcas/marcas-form.js | |
import Component from '@ember/component'; | |
export default Component.extend({ | |
//https://guides.emberjs.com/v3.3.0/components/triggering-changes-with-actions/ | |
//https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/closure-actions.md | |
// Noop, needs to be overriden | |
onSave() {}, | |
actions: { | |
saveMarca(marca) { | |
marca.save().then(() => { | |
return this.onSave(); | |
}); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//app/routes/marcas/new.js | |
import Component from '@ember/component'; | |
export default Component.extend({ | |
actions: { | |
deleteMarca(marca) { | |
marca.destroyRecord(); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//app/routes/marcas/new.js | |
import Controller from '@ember/controller'; | |
export default Controller.extend({ | |
actions: { | |
redirectTo() { | |
return this.transitionTo('marca'); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//app/routes/marcas/new.js | |
import Route from '@ember/routing/route'; | |
export default Route.extend({ | |
model() { | |
return this.store.createRecord('marca'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment