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

two-way binding paper-input #49

Closed
brOOper opened this issue Jul 22, 2016 · 9 comments
Closed

two-way binding paper-input #49

brOOper opened this issue Jul 22, 2016 · 9 comments

Comments

@brOOper
Copy link

brOOper commented Jul 22, 2016

The two way databinding does seem to work only in one direction. The value gets set on the paper-input but when changing, the model field (customer.firstname in this case) is not being updated.

<paper-input [(value)]="customer.firstname" label="Firstname"></paper-input>

(Version v1.0.0-beta2)

@Saulis
Copy link
Contributor

Saulis commented Aug 1, 2016

Hi!

Tried reproducing with

<label>{{model.foobar | json}}</label>
<input type="text" [value]="model.foobar" (input)="model.foobar=$event.target.value">
<paper-input [(value)]="model.foobar"></paper-input>

And everything seems to update like it should. Have you remembered to add PolymerElement('paper-input') directive?

If still not working, could provide a full example where the problem occurs? Thanks!

@florent1933
Copy link

florent1933 commented Aug 3, 2016

Same problem:

This one is working [value]="model.foobar" (input)="model.foobar=$event.target.value"

but not:

  • [(value)]="model.foobar"
  • [(ngModel)]="model.foobar"

Stacktrace for [(ngModel)], seems to be related #41:
ORIGINAL EXCEPTION: No value accessor for ''BrowserDomAdapter.logError @ browser_adapter.ts:82 browser_adapter.ts:82 ORIGINAL STACKTRACE:BrowserDomAdapter.logError @ browser_adapter.ts:82 browser_adapter.ts:82Error: No value accessor for '' at new BaseException (exceptions.ts:21) at _throwError (shared.ts:66) at Object.setUpControl (shared.ts:38) at NgModel.ngOnChanges (ng_model.ts:42) at DebugAppView._View_IndexSearchComponent0.detectChangesInternal (IndexSearchComponent.template.js:250) at DebugAppView.AppView.detectChanges (view.ts:261) at DebugAppView.detectChanges (view.ts:377) at DebugAppView.AppView.detectViewChildrenChanges (view.ts:288) at DebugAppView._View_IndexComponent0.detectChangesInternal (IndexComponent.template.js:166) at DebugAppView.AppView.detectChanges (view.ts:261)BrowserDomAdapter.logError @ browser_adapter.ts:82 browser_adapter.ts:82ERROR CONTEXT:BrowserDomAdapter.logError @ browser_adapter.ts:82 browser_adapter.ts:82DebugContext

Angular : 2.0.0-rc.4

@brOOper
Copy link
Author

brOOper commented Aug 3, 2016

I put the directive PolymerElement('paper-input') in the parent component so I have to put it only once. Moving it to the component where it is used made it work.

@Saulis Why can't I just put it on the parent component like other directives?

@florent1933
Copy link

@brOOper : Do you have two way data binding with:

  • [(value)]="model.foobar"
  • [(ngModel)]="model.foobar" ?

@platosha
Copy link
Owner

Is it that you are using the Angular’s New Forms module? If so, this should be fixed by #55. Please try again with the master version of @vaadin/angular2-polymer.

@oravecz
Copy link

oravecz commented Sep 16, 2016

It seems that the newer versions of Angular2 are incompatible with the PolymerElement() call. Without that function to wire up 2-way data binding, what is an alternative?

#84

@platosha
Copy link
Owner

We can’t reproduce the original issue, closing.

@oravecz We don’t have an answer yet. Looks like you are facing the same issue as in #86, so let us continue there.

@oravecz
Copy link

oravecz commented Sep 16, 2016

As long as I add the PolymerElement(...) to NgModule, and not to the component, then all works as expected.

declarations: [
        AppComponent,
        PolymerElement( 'paper-input' )
]

@niveo
Copy link

niveo commented Sep 21, 2016

this don't works

<paper-radio-group [(selected)]="model.select">
     <paper-radio-button name="1">yes</paper-radio-button>
     <paper-radio-button name="0">no</paper-radio-button>
</paper-radio-group>

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

6 participants