yuяi
yuяi

Reputation: 2725

Handling ember actions from bootstrap addons Notifications component

I use Ember Addons Bootstrap for Ember, specifically their Notifications component.

I have a new requirement to create an Undo button on the notifications. I can successfully put hbs template code into the message:

msg = "Success! <a href='#' {{action 'undo'}}>undo</a>"
Bootstrap.NM.push msg.htmlSafe(), "success"

This displays the Undo link nicely, but no matter where I put the action handler within my app, I can't get it to get triggered.

What's the best way to tie the Notifications code into my app so that the undo action can be handled?

Upvotes: 2

Views: 144

Answers (1)

Kingpin2k
Kingpin2k

Reputation: 47367

It isn't supported.

Not suggesting this, but if you have a hard requirement and you give up on other routes, you will need to accesss Ember outside of the ember application's scope.

"Success! <a href='#' onclick='foobar()'>undo</a>"

function foobar(){
  // where App is your Ember app
  // and foo is the controller name, App.FooController
  var controller = App.__container__.lookup('controller:foo');
  controller.send('undo');
}

Upvotes: 2

Related Questions