How to get parent controller?



Here is my view/misc/ script

App.TextFieldOnKeyUp = Em.TextField.extend

keyUp: (e) ->
    console.log 'controller - ' + @get('controller')
And this is index.emblem inside templates/users/

= view App.TextFieldOnKeyUp valueBinding=“searchQuery” placeholder=“Search”

My question is, why am I not gettign the “UsersIndexController” in App.TextFieldOnKeyUp? Please help me ASAP

Thanks in advance.


I think what you maybe looking for is parentView but I’m not 100% sure from your post how deeply nested your view is.


Hi @varblob , yes, parentView. I’ve created new textbox with keyup event. But not getting the parent while trying to console.log the this.get(‘controller’) value.

I get


as a parentView, I need the name of view in which I’ve created this textbox.


parentView.controller solved my problem. Thank you @varblob so much :clap: