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

beta2 - dynamically changing p-dropdown [options] and ngModel value crashes #218

Closed
gatapia opened this issue Apr 17, 2016 · 1 comment
Closed
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@gatapia
Copy link
Contributor

gatapia commented Apr 17, 2016

Reproduceable with the following:

Template:

<p-dropdown [options]="dummylist" [(ngModel)]="dummyid"></p-dropdown>
<button (click)='adddummy()'>Add</button>

Component:

public dummylist: any[] = [{label: '1', value: 1}];
public dummyid: number = 1;

adddummy() {
  const newv = this.dummyid + 1;
  this.dummylist.push({label: newv.toString(), value: newv});
  this.dummyid = newv;
  console.log('this.dummylist:', this.dummylist, 'this.dummyid:', this.dummyid)
}

This gives the following crash:

this.dummylist: 
  0: Object:
    label: "1"
    value: 1
  1 Object
    label: "2"
    value: 2
this.dummyid: 2

angular2.dev.js:23887 EXCEPTION: TypeError: Cannot read property 'classList' of undefined in [null]
angular2.dev.js:23877 EXCEPTION: TypeError: Cannot read property 'classList' of undefined in [null]BrowserDomAdapter.logError @ angular2.dev.js:23877BrowserDomAdapter.logGroup @ angular2.dev.js:23888ExceptionHandler.call @ angular2.dev.js:1317(anonymous function) @ angular2.dev.js:12763schedulerFn @ angular2.dev.js:13167SafeSubscriber.__tryOrUnsub @ Rx.js:10855SafeSubscriber.next @ Rx.js:10810Subscriber._next @ Rx.js:10766Subscriber.next @ Rx.js:10743Subject._finalNext @ Rx.js:11425Subject._next @ Rx.js:11417Subject.next @ Rx.js:11376EventEmitter.emit @ angular2.dev.js:13148onError @ angular2.dev.js:13566onHandleError @ angular2.dev.js:2128ZoneDelegate.handleError @ angular2-polyfills.js:336Zone.runGuarded @ angular2-polyfills.js:244NgZoneImpl.runInner @ angular2.dev.js:2140NgZone.run @ angular2.dev.js:13649(anonymous function) @ angular2.dev.js:12862schedulerFn @ angular2.dev.js:13167SafeSubscriber.__tryOrUnsub @ Rx.js:10855SafeSubscriber.next @ Rx.js:10810Subscriber._next @ Rx.js:10766Subscriber.next @ Rx.js:10743Subject._finalNext @ Rx.js:11425Subject._next @ Rx.js:11417Subject.next @ Rx.js:11376EventEmitter.emit @ angular2.dev.js:13148NgZone._checkStable @ angular2.dev.js:13589onLeave @ angular2.dev.js:13556onInvoke @ angular2.dev.js:2113ZoneDelegate.invoke @ angular2-polyfills.js:331Zone.runGuarded @ angular2-polyfills.js:241NgZoneImpl.runInner @ angular2.dev.js:2140NgZone.run @ angular2.dev.js:13649outsideHandler @ angular2.dev.js:13495ZoneDelegate.invokeTask @ angular2-polyfills.js:365Zone.runTask @ angular2-polyfills.js:263ZoneTask.invoke @ angular2-polyfills.js:431
angular2.dev.js:23877 ORIGINAL EXCEPTION: TypeError: Cannot read property 'classList' of undefinedBrowserDomAdapter.logError @ angular2.dev.js:23877ExceptionHandler.call @ angular2.dev.js:1326(anonymous function) @ angular2.dev.js:12763schedulerFn @ angular2.dev.js:13167SafeSubscriber.__tryOrUnsub @ Rx.js:10855SafeSubscriber.next @ Rx.js:10810Subscriber._next @ Rx.js:10766Subscriber.next @ Rx.js:10743Subject._finalNext @ Rx.js:11425Subject._next @ Rx.js:11417Subject.next @ Rx.js:11376EventEmitter.emit @ angular2.dev.js:13148onError @ angular2.dev.js:13566onHandleError @ angular2.dev.js:2128ZoneDelegate.handleError @ angular2-polyfills.js:336Zone.runGuarded @ angular2-polyfills.js:244NgZoneImpl.runInner @ angular2.dev.js:2140NgZone.run @ angular2.dev.js:13649(anonymous function) @ angular2.dev.js:12862schedulerFn @ angular2.dev.js:13167SafeSubscriber.__tryOrUnsub @ Rx.js:10855SafeSubscriber.next @ Rx.js:10810Subscriber._next @ Rx.js:10766Subscriber.next @ Rx.js:10743Subject._finalNext @ Rx.js:11425Subject._next @ Rx.js:11417Subject.next @ Rx.js:11376EventEmitter.emit @ angular2.dev.js:13148NgZone._checkStable @ angular2.dev.js:13589onLeave @ angular2.dev.js:13556onInvoke @ angular2.dev.js:2113ZoneDelegate.invoke @ angular2-polyfills.js:331Zone.runGuarded @ angular2-polyfills.js:241NgZoneImpl.runInner @ angular2.dev.js:2140NgZone.run @ angular2.dev.js:13649outsideHandler @ angular2.dev.js:13495ZoneDelegate.invokeTask @ angular2-polyfills.js:365Zone.runTask @ angular2-polyfills.js:263ZoneTask.invoke @ angular2-polyfills.js:431
angular2.dev.js:23877 ORIGINAL STACKTRACE:BrowserDomAdapter.logError @ angular2.dev.js:23877ExceptionHandler.call @ angular2.dev.js:1329(anonymous function) @ angular2.dev.js:12763schedulerFn @ angular2.dev.js:13167SafeSubscriber.__tryOrUnsub @ Rx.js:10855SafeSubscriber.next @ Rx.js:10810Subscriber._next @ Rx.js:10766Subscriber.next @ Rx.js:10743Subject._finalNext @ Rx.js:11425Subject._next @ Rx.js:11417Subject.next @ Rx.js:11376EventEmitter.emit @ angular2.dev.js:13148onError @ angular2.dev.js:13566onHandleError @ angular2.dev.js:2128ZoneDelegate.handleError @ angular2-polyfills.js:336Zone.runGuarded @ angular2-polyfills.js:244NgZoneImpl.runInner @ angular2.dev.js:2140NgZone.run @ angular2.dev.js:13649(anonymous function) @ angular2.dev.js:12862schedulerFn @ angular2.dev.js:13167SafeSubscriber.__tryOrUnsub @ Rx.js:10855SafeSubscriber.next @ Rx.js:10810Subscriber._next @ Rx.js:10766Subscriber.next @ Rx.js:10743Subject._finalNext @ Rx.js:11425Subject._next @ Rx.js:11417Subject.next @ Rx.js:11376EventEmitter.emit @ angular2.dev.js:13148NgZone._checkStable @ angular2.dev.js:13589onLeave @ angular2.dev.js:13556onInvoke @ angular2.dev.js:2113ZoneDelegate.invoke @ angular2-polyfills.js:331Zone.runGuarded @ angular2-polyfills.js:241NgZoneImpl.runInner @ angular2.dev.js:2140NgZone.run @ angular2.dev.js:13649outsideHandler @ angular2.dev.js:13495ZoneDelegate.invokeTask @ angular2-polyfills.js:365Zone.runTask @ angular2-polyfills.js:263ZoneTask.invoke @ angular2-polyfills.js:431
angular2.dev.js:23877 TypeError: Cannot read property 'classList' of undefined
    at DomHandler.addClass (domhandler.js:15)
    at Dropdown.highlightValue (dropdown.js:98)
    at Dropdown.writeValue (dropdown.js:65)
    at Control._onChange (angular2.dev.js:20975)
    at Control.updateValue (angular2.dev.js:15790)
    at NgModel.ngOnChanges (angular2.dev.js:16810)
    at AbstractChangeDetector.ChangeDetector_OpportunityEditComponent_0.detectChangesInRecordsInternal (viewFactory_OpportunityEditComponent:101)
    at AbstractChangeDetector.detectChangesInRecords (angular2.dev.js:9609)
    at AbstractChangeDetector.runDetectChanges (angular2.dev.js:9592)
    at AbstractChangeDetector._detectChangesInViewChildren (angular2.dev.js:9671)
@cagataycivici
Copy link
Member

Will review and give an update.

@cagataycivici cagataycivici added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Apr 18, 2016
@cagataycivici cagataycivici added this to the 1.0.0-beta.3 milestone Apr 18, 2016
@cagataycivici cagataycivici self-assigned this Apr 18, 2016
@cagataycivici cagataycivici added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Pending Review Issue or pull request is being reviewed by Core Team labels Apr 19, 2016
atretyak1985 added a commit to Nanitor/primeng that referenced this issue Jul 18, 2020
* add base list service
* add base list component
* add device detail service
* software component refactoring
* fix build issues
* move functions from base list to software component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

2 participants