Getting [Object object] when using ng-model on a named form

后端 未结 4 1128
孤街浪徒
孤街浪徒 2021-02-14 07:12

If I have the following:

4条回答
  •  执笔经年
    2021-02-14 07:29

    I guess either the registration scope is not initialized or registration.first_name is an object.

    Have a look at this plunker: http://plnkr.co/edit/bdbs0XVB8hZSodOTYyM4?p=preview

    Initialize the registation model either in controller or using ng-init ng-init="registration = {}"

    If registration.first_name is an object then this will be displayed as [Object object]. You have to supply a proper string value as model to the ng-model

提交回复
热议问题