5
rated 0 times
[
6]
[
1]
/ answers: 1 / hits: 22233
/ 6 Years ago, tue, august 7, 2018, 12:00:00
I want to assign [(ngModel)] inside my .html code to an object which is empty (null or undefined), but it gives error of _co.object is null.
There are 2 cases, 1st when my object has value, 2nd when it does not. First case ngModel works fine, but when it comes to second, it gives error of being null. With elvis(?) operator i tried, it does not help.
Problem was solved !! THank you all
My .ts page
profile: Profile = {
fullName: '',
email: '',
address: '',
};
My .html page
<ion-item>
<ion-label>Full Name:</ion-label>
<ion-input [(ngModel)]="profile.fullName"></ion-input>
</ion-item>
ERROR TypeError: "_co.profile is null"
More From » angular