Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

ng-model not working with a simple variable on $scope #18

Closed
@tkrotoff

Description

@tkrotoff

Inside demo.html, if you replace ng-model="data.custom":

<ui-select ng-model="data.custom">
  ...
</ui-select>

by ng-model="myItem":

<ui-select ng-model="myItem">
  ...
</ui-select>

$scope.myItem never gets set.
It's like ngModelCtrl.$setViewValue(newVal) cannot bind to a simple variable $scope.myItem.

It will work only if ng-model is an object:

  • demo.js: $scope.myItem = {}
  • demo.html: ng-model="myItem.data"

I could not figure out why, any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions