Skip to content

Instantly share code, notes, and snippets.

@kumkanillam
Last active August 2, 2016 19:41
Show Gist options
  • Save kumkanillam/9b2c856e409d0bc8a4b3faa4a1b0b2d7 to your computer and use it in GitHub Desktop.
Save kumkanillam/9b2c856e409d0bc8a4b3faa4a1b0b2d7 to your computer and use it in GitHub Desktop.
Kumkan-action bubble
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
isAuthenticated: true,
actions: {
logIn: function(){
this.toggleProperty('isAuthenticated');
console.log('login application ',this.get('isAuthenticated'));
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appCont:Ember.inject.controller('application'),
actions:{
logIn(){
console.log('logIn in login controller');
}
}
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('boards',{path:'/boards'});
this.route('login');
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
});
<h1>Welcome to {{appName}}</h1>
<br>
{{#link-to 'login'}} GoToLogin {{/link-to}}
<br>
{{outlet}}
<br>
<br>
<h2> Login Page</h2>
<button {{action 'logIn' target=appCont}}> Login </button>
<div>
{{#link-to 'boards' (action 'logIn' target=appCont preventDefault=false) }}Login{{/link-to}}
</div>
{
"version": "0.10.4",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment