Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input value binding not working in beta-2.0.0-beta.5 #12044

Closed
csprocket777 opened this issue Aug 10, 2015 · 6 comments
Closed

Input value binding not working in beta-2.0.0-beta.5 #12044

csprocket777 opened this issue Aug 10, 2015 · 6 comments

Comments

@csprocket777
Copy link

In 2.0.0-beta.4, the following works to update the "identification" property on the controller:

{{input value=controller.identification placeholder='' classNames="form-control input-lg" disabled=loginProcessing}}

This code doesn't work in beta-2.0.0-beta.5.

Am I doing something wrong?

@rwjblue
Copy link
Member

rwjblue commented Aug 10, 2015

classNames doesn't work (#12039 and #12008) which is likely what is going on...

@rwjblue
Copy link
Member

rwjblue commented Aug 10, 2015

Also, using controller.asdfa and view.asdf paths in a template are deprecated (and should not work, though I am unsure if that work is finished).

@csprocket777
Copy link
Author

I swapped my template code to the following:

<input type="text" value="{{identification}}" />

Still do not get the value from the input field when typing into it.

Also, for the heck of it, tried:

<input type="text" value="{{controller.identification}}" />

no luck.

I have no console errors nor any deprecation warnings in the ember inspector (chrome).

@csprocket777
Copy link
Author

For the sake of complete code context, here's the code for the entire template:

<div class="row">

    <div class="col-xs-10 col-sm-6 col-md-4 col-lg-6 col-xs-offset-1 col-sm-offset-3 col-md-offset-4 col-lg-offset-3 text-center">
        <form {{action 'authenticate' on='submit'}} class="login_box text-center styled-inputs">
            <h1 class="application_title thin color_DkGray2">Recruiter - Admin</h1>

            {{#if auth.loginCapable}}
                <div class="form-group">
                    <input type="text" value="{{identification}}" placeholder='Username' class="form-control input-lg" disabled={{loginProcessing}} />
                </div>
                <div class="form-group submit_btn_row">
                    <button type="submit" class="btn btn-primary" disabled={{loginButtonDisabled}}>
                        {{#unless loginProcessing}}
                            Continue
                        {{else}}
                            {{icon-spinner}}
                        {{/unless}}
                    </button>
                </div>
            {{/if}}

            {{#if error}}
                <div class="alert alert-warning alert-block login_error">
                    <h4>{{{error_title}}}</h4>
                    <p>
                        {{{error_description}}}
                    </p>
                </div>
            {{/if}}
        </form>
    </div>
</div>

Component controller code:

import Ember from 'ember';

export default Ember.Component.extend({
    auth: Ember.inject.service(),
    classNames: ['login_container', 'container-fluid'],

    loginProcessing: false,
    loginButtonDisabled: Ember.computed.alias('loginProcessing'),

    error: null,
    error_title: "Login Error",
    error_description: null,

    actions:{
        authenticate() {
            this.setProperties({
                loginProcessing: true,
                error: null,
                error_description: null
            });
            var data = this.get('identification');

            this.get('auth').login(data).then(()=>{

                this.setProperties({
                    loginProcessing: false,
                    error: null,
                    error_description: null
                });

            }, message =>{

                this.setProperties({
                    error: message.message,
                    error_description: message.message,
                    loginProcessing: false
                });

            });
        }
    }
});

My bower.json file:

{
  "name": "recruiter-admin",
  "dependencies": {
    "ember": "2.0.0-beta.5",
    "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
    "ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
    "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5",
    "ember-qunit": "0.4.7",
    "ember-qunit-notifications": "0.0.7",
    "ember-resolver": "~0.1.18",
    "jquery": "^1.11.1",
    "loader.js": "ember-cli/loader.js#3.3.0",
    "qunit": "~1.17.1",
    "bootstrap-sass": "3.3.5",
    "fontawesome": "4.3.0",
    "animate.css": "3.2.6",
    "pretender": "^0.9.0"
  },
  "devDependencies": {
    "bootstrap": "~3.3.5"
  },
  "resolutions": {
    "ember": "2.0.0-beta.5"
  }
}

My package.json file:

{
  "name": "recruiter-admin",
  "version": "0.0.0",
  "description": "Small description for recruiter-admin goes here",
  "private": true,
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "scripts": {
    "start": "ember server",
    "build": "ember build",
    "test": "ember test"
  },
  "repository": "",
  "engines": {
    "node": ">= 0.10.0"
  },
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "broccoli-asset-rev": "^2.0.2",
    "broccoli-funnel": "^0.2.3",
    "ember-bootstrap-sass": "0.1.0",
    "ember-cli": "1.13.6",
    "ember-cli-app-version": "0.4.0",
    "ember-cli-babel": "^5.0.0",
    "ember-cli-content-security-policy": "0.4.0",
    "ember-cli-dependency-checker": "^1.0.0",
    "ember-cli-htmlbars": "0.7.9",
    "ember-cli-htmlbars-inline-precompile": "^0.1.1",
    "ember-cli-ic-ajax": "0.2.1",
    "ember-cli-inject-live-reload": "^1.3.0",
    "ember-cli-pretender": "0.4.0",
    "ember-cli-qunit": "0.3.18",
    "ember-cli-release": "0.2.3",
    "ember-cli-sri": "^1.0.1",
    "ember-cli-uglify": "^1.0.1",
    "ember-disable-proxy-controllers": "^1.0.0",
    "ember-export-application-global": "^1.0.3",
    "ui-icon": "0.5.0"
  },
  "dependencies": {
    "ember-cli-sass": "^4.0.1"
  }
}

@csprocket777
Copy link
Author

Ok. so I see what you mean.

This works in beta.4 and beta.5:

{{input value=identification placeholder='Enter Username' disabled=loginProcessing}}

sans 'classNames' attribute. Hrmmmmm.

@csprocket777
Copy link
Author

Ok. My mistake. changed "classNames" to "class", all is solved. World can continue spinning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants