ember.js - Accessing Ember object instances in debugger -
in debugger it's easy enough @ class definitions of objects i've created typing in app.classname.prototype
. ok not hugely interesting still when you're first feeling around in "ember dark". instances though? that's want access to.
if app has moved activitiesbydateroute
, instantiated activitiesbydatecontroller
there must instance of activitiesbydatecontroller
container stored in? thought maybe ember debugger (aka, ember-extension) might me figure out. think should i'm not getting it. following indicate me?
it appears instance name ember461
how manipulate in debugger? i've tried app.ember461
... no go. i've tried app.activitiesbydatecontroller.ember461
... no go.
anyway, gist of question. please help, i'm couple objects short of instance.
here of easiest way manipulate ember model.
just output 1 of model's properties onto page
{{ somevalue }}
bind value input box
{{ input value=somevalue }}
log value of object when template being generated first time (not when changing).
{{ log somevalue }}
stop template while it's being generated can view model.
{{ debugger }}
output context(s) of template being built
{{this}} {{model}} {{controller}} {{view}}
check out model in setupcontroller hook in route, or terrible making model global variable view anywhere (i'd use testing/debugging)
app.someroute = ember.route.extend({ setupcontroller: function(controller, model) { this._super(controller, model); globalsomemodel = model; // wouldn't recommend polluting global scope except testing etc. } });
trying grab portions of ember , use/manipulate them outside of ember run loop can give unexpected results.
here's info left on post getting controller instance outside of ember run loop though.
var controller = application.__container__.lookup('controller:somecamelcasename');
some of previous things mentioned viewable in jsbin http://jsbin.com/efajen/1/edit
Comments
Post a Comment