Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7830199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:07:13+00:00 2026-06-02T11:07:13+00:00

I have this code for view: App.TodoView = Em.View.extend({ labelView: Em.TextField.extend({ }), createNew:function ()

  • 0

I have this code for view:

App.TodoView = Em.View.extend({
    labelView: Em.TextField.extend({

    }),
    createNew:function () {
        console.log(this.labelView.get('value'));
    }
});

and this template:

{{#view App.TodoView}}    
    {{view labelView}}    
    {{#view Em.Button target="parentView" action="createNew"}}Add{{/view}}    
{{/view}}

And I get the following error:

Uncaught TypeError: Object (subclass of Ember.TextField) has no method 'get'

I want to use insertNewLine method too, so I can set the value of the Em.TextField in template.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T11:07:15+00:00Added an answer on June 2, 2026 at 11:07 am

    The problem is that you are defining a class and trying to get the value from it. What you rather want is to get the value of a concrete instance. This can be achieved by binding the value of the LabelView to a value which can then be retrieved in the App.TodoView, in this case todoLabel, see http://jsfiddle.net/pangratz666/PTPsV/:

    Handlebars:

    {{#view App.TodoView }}
        <!-- Bind the value of the LabelView to todoLabel on the App.TodoView -->
        {{view LabelView valueBinding="todoLabel" }}
        {{#view Em.Button target="parentView" action="createNew" }}Add{{/view}}
    {{/view}}
    

    JavaScript:

    App.TodoView = Em.View.extend({
        LabelView: Em.TextField.extend(),
    
        createNew: function(){
            var value = this.get('todoLabel');
            console.log( 'le todoLabel', value );
        }
    });​
    

    Note that since you are defining a class LabelView it’s a convention to write it in Uppercase, whereas instances are written in lowerCase. See a good blog post about naming convention by The Emberist.

    Also, to access a property on an Ember.Object, you should always use get, so it’s this.get('todoLabel') and not this.todoLabel.


    You can now implement further methods like insertNewline and cancel – note it’s insertNewline and not insertNewLine, see text_support.

    The result would look like this, see http://jsfiddle.net/pangratz666/9ZLAC/:

    App.TodoView = Em.View.extend({
        LabelView: Em.TextField.extend({
            insertNewline: function(){
                this.get('parentView').createNew();
            },            
            cancel: function(){
                this.set('value', '');
            }
        }),
    
        createNew: function(){
            var value = this.get('todoLabel');
            console.log( 'le todoLabel', value );
        }
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given that I have this code: Ember.App.View = Ember.View.extend({ templateName: templateA }); Ember.App.View =
Hi I have this code in my view.. <%=Html.DropDownList(ProductTemplate,new SelectList(Model.ProductTemplate,Value,Text))%> I know if this
I have this code in a prepareForSegue method // Get destination view UIViewController *viewController
i have this code package com.tct.soundTouch; import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.view.MotionEvent;
I have this code: package com.problemio; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View;
I am working on an app that have this code on a view file
I have this code in my view: echo form_label('State', 'state'); $options = array( 'No
I have this code: tableList = [[NSMutableArray alloc] initWithObjects:@First View,@Second View,nil]; I have synthesized
I have this code for my soundboard, public class soundboardActivity extends Activity { View
I have this code: hubSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.