Ember.js: data binding between controllers

I am trying to link in ApplicationController with IndexController. Here is my jsfiddle . To summarize, here is the link I have in the application controller

indexIsClickedBinding: "App.indexController.isClicked",

isIndexClicked: function() {
    alert("its changed to " + this.get("indexIsClicked") ) ;
}.observes('indexIsClicked'), 

So, when the isClicked value in the IndexController changes, but indexIsClickedBinding does nothing. Any suggestions on what's wrong in my code?

Greetings

+5
source share
2 answers

While the solution is simple, let me try to explain it. Please feel free to ask any questions if you are not sure.

App.indexController. , Ember.JS App.

App Ember, , , .

Ember.JS . . Ember.JS :

, needs, , , : http://jsfiddle.net/uB5tX/7/

needs, . , Ember.JS . App, , / Ember.JS , needs, , needs , .

+23

:

import Ember from 'ember';

export default Ember.Controller.extend({
  index: Ember.inject.controller('index'),
  indexIsClicked: Ember.computed.alias("index.isClicked"),

  isIndexClicked: Ember.observer('index.isClicked', function() {
    alert("its changed to " + this.get("indexIsClicked"));
  })
});

Ember , - , index ( ). , , :

Is index clicked: <b>{{indexIsClicked}}</b>

.

0

All Articles