Comments (6)
It's originally meant to mimic Rails' style flash messages. Is there a reason why you want to have a flash message inside of an Ember.Object? I'm not opposed to creating a mixin, just curious what the use case is
from ember-cli-flash.
I am trying to inject it in another service which I am using in my controller. I am new to emberJS so I am not as familiar with the design patterns. Let me know if there is a better way to do it.
from ember-cli-flash.
Actually, is it supposed to work with an objectController? I just tried and I am getting an error:
Uncaught TypeError: Cannot read property 'success' of undefined
My code looks like this:
import Ember from 'ember';
export default Ember.ObjectController.extend({
handleChangeStateCallback: function(update, campaign, flash){
update.done(function(data) {
flash.success(data.notice);
campaign.set('status', data.started);
})
.fail(function(xhr, textStatus, errorThrown) {
alert('start campaign failed');
});
},
actions: {
deleteCampaign: function(){
var campaign = this.get('model');
campaign.deleteRecord();
campaign.save();
},
changeCampaignState: function(action){
var flash = Ember.get(this, 'flashes');
var campaign = this.get('model');
var update = this.agentGatewayService.changeCampaignState(campaign, action);
this.handleChangeStateCallback(update, campaign, flash);
}
}
});
from ember-cli-flash.
I've found a need to use Flash messages in mixins.
+1 for access within Ember.Object, preferably a manual method. Something like...
import Ember from 'ember';
import Flash from 'ember-cli-flash/mixin/flash';
export default Ember.Mixin.create({
actions:{
someAction: function(){
Flash.success('FLASH me! Well, not THAT type of FLASH, the other less risqué' meaning of FLASH. Put your shirt on.');
}
}
});
from ember-cli-flash.
Alright, I'll put this in the next milestone
from ember-cli-flash.
Hey guys, I'm deciding against making a mixin out of the service, as isn't really necessary if your object is registered in the container. You can use Ember.inject.service
to get a reference to the service.
from ember-cli-flash.
Related Issues (20)
- @ember-decorators/component dependency missing HOT 1
- Cannot Use Selectors on Flash Message HOT 2
- Duplicate version tags HOT 1
- preventDuplicates w/ custom dedupe property
- Installation crashes with: [ember-cli-version-checker] 'checker.forEmber' has been removed, please use 'checker.for(`ember-source`)' HOT 2
- Throws when used with ember-cli-babel `includeExternalHelpers: true`
- Using a modifier for flash-message component
- [DEPRECATE] getWithDefault HOT 1
- Ember 3.24: installing ember-cli-flash throws error from ember-cli-version-checker HOT 1
- type definitions do not work / are not detected HOT 8
- Fix `this-property-fallback` deprecation warnings
- The `did-insert` modifier is missing
- Does this addon still need the "ember-runtime-enumerable-includes-polyfill" dependency?
- Ember 3.26+: `manager-capabilities.modifiers-3-13` deprecation
- Cut a major 3.0 release HOT 12
- Deprecations in Ember v4.0+ HOT 1
- Error passing in unknown MessageOptions in TypeScript
- flashMessages is not working in newly create ember app HOT 1
- How do you add to the queue via template?
- Release planning HOT 5
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-flash.