{"action":"closed","issue":{"url":"https://api.github.com/repos/DanielYKPan/date-time-picker/issues/272","repository_url":"https://api.github.com/repos/DanielYKPan/date-time-picker","labels_url":"https://api.github.com/repos/DanielYKPan/date-time-picker/issues/272/labels{/name}","comments_url":"https://api.github.com/repos/DanielYKPan/date-time-picker/issues/272/comments","events_url":"https://api.github.com/repos/DanielYKPan/date-time-picker/issues/272/events","html_url":"https://github.com/DanielYKPan/date-time-picker/issues/272","id":296650451,"number":272,"title":"Error on refresh of nested form","user":{"login":"rovercoder","id":13407974,"avatar_url":"https://avatars2.githubusercontent.com/u/13407974?v=4","gravatar_id":"","url":"https://api.github.com/users/rovercoder","html_url":"https://github.com/rovercoder","followers_url":"https://api.github.com/users/rovercoder/followers","following_url":"https://api.github.com/users/rovercoder/following{/other_user}","gists_url":"https://api.github.com/users/rovercoder/gists{/gist_id}","starred_url":"https://api.github.com/users/rovercoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rovercoder/subscriptions","organizations_url":"https://api.github.com/users/rovercoder/orgs","repos_url":"https://api.github.com/users/rovercoder/repos","events_url":"https://api.github.com/users/rovercoder/events{/privacy}","received_events_url":"https://api.github.com/users/rovercoder/received_events","type":"User","site_admin":false},"labels":[{"id":488552525,"url":"https://api.github.com/repos/DanielYKPan/date-time-picker/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-13T08:28:19Z","updated_at":"2018-03-06T06:53:50Z","closed_at":"2018-03-06T06:53:50Z","author_association":"NONE","body":"Happens whenever component is destroyed before registerInput() is called.\r\n\r\n```\r\nOwlDateTimeComponent.prototype.ngOnDestroy = function () {\r\n    this.clean();\r\n    **if (this.dtInputSub)** //suggestion\r\n        this.dtInputSub.unsubscribe();\r\n    this.disabledChange.complete();\r\n    if (this.popupRef) {\r\n        pRef.dispose();\r\n    }\r\n};\r\n```\r\n\r\nUsing picker as so:\r\n\r\nouter.component.html\r\n`<form #customerForm=\"ngForm\"><custom-form></custom-form></form>`\r\n\r\ncustom-form.component.ts\r\n`@Component({ ... viewProviders: [ { provide: ControlContainer, useExisting: NgForm } ] })`\r\n\r\ncustom-form.component.html\r\n\r\n```\r\n<input \r\n          #dateOfBirthFd=\"ngModel\"\r\n          ngModel\r\n          id=\"dateOfBirth\"\r\n          name=\"dateOfBirth\"\r\n          class=\"form-control\"\r\n          type=\"text\"\r\n          [owlDateTime]=\"dateOfBirthPicker\"\r\n          [owlDateTimeTrigger]=\"dateOfBirthPicker\"\r\n          [min]=\"dateLimits[0]\"\r\n          [max]=\"dateLimits[1]\"\r\n          placeholder=\"YYYY-MM-DD\"\r\n          required\r\n/>\r\n<span [owlDateTimeTrigger]=\"dateOfBirthPicker\"><i class=\"fa fa-calendar\"></i></span>\r\n<owl-date-time\r\n       #dateOfBirthPicker\r\n        [pickerType]=\"'calendar'\"\r\n        [startView]=\"'year'\"\r\n</owl-date-time>\r\n```\r\n\r\n\r\n> ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'unsubscribe' of undefined\r\nTypeError: Cannot read property 'unsubscribe' of undefined\r\n    at OwlDateTimeComponent.ngOnDestroy (date-time-picker.component.js:187)\r\n    at callProviderLifecycles (core.js:12705)\r\n    at callElementProvidersLifecycles (core.js:12666)\r\n    at callLifecycleHooksChildrenFirst (core.js:12649)\r\n    at destroyView (core.js:14015)\r\n    at callViewAction (core.js:14166)\r\n    at execComponentViewsAction (core.js:14078)\r\n    at destroyView (core.js:14014)\r\n    at callViewAction (core.js:14166)\r\n    at execComponentViewsAction (core.js:14078)\r\n    at OwlDateTimeComponent.ngOnDestroy (date-time-picker.component.js:187)\r\n    at callProviderLifecycles (core.js:12705)\r\n    at callElementProvidersLifecycles (core.js:12666)\r\n    at callLifecycleHooksChildrenFirst (core.js:12649)\r\n    at destroyView (core.js:14015)\r\n    at callViewAction (core.js:14166)\r\n    at execComponentViewsAction (core.js:14078)\r\n    at destroyView (core.js:14014)\r\n    at callViewAction (core.js:14166)\r\n    at execComponentViewsAction (core.js:14078)\r\n    at resolvePromise (zone.js:809)\r\n    at resolvePromise (zone.js:775)\r\n    at eval (zone.js:858)\r\n    at ZoneDelegate.invokeTask (zone.js:421)\r\n    at Object.onInvokeTask (core.js:4724)\r\n    at ZoneDelegate.invokeTask (zone.js:420)\r\n    at Zone.runTask (zone.js:188)\r\n    at drainMicroTaskQueue (zone.js:595)\r\n    at ZoneTask.invokeTask [as invoke] (zone.js:500)\r\n    at invokeTask (zone.js:1517)"}}
{"actor":{"display_login":"DanielYKPan"}}