Controller property not recognized


#1

in the controller defined statements property : export default Ember.Controller.extend({ … statements : [], … }), I try to get this property in function but the property not recognized : let scatterController = Ember.inject.controller(‘sqlserver.pi.scatter-chart-analyitics’); // my controller

function getStatments() { scatterController.statements ; }


#2

Try this:

function getStatments() {
  scatterController.get('statements');
}

You generally need to use .get('$property_name') when accessing properties in Ember objects.


#3

thanks, I try it. but it’s not help


#4

If I am not wrong , Ember.inject.controller doesnt returns you the controller itself , It injects the requested controller in the required controller.

For Eg:

scatterController : Ember.inject.controller('sqlserver.pi.scatter-chart-analyitics'),
getStatments : function(){
 return this.get('scatterController.statements');
}