AngularJS: Select not 2-way binding to model

后端 未结 2 1871
天涯浪人
天涯浪人 2021-01-31 02:11

I am using a select to show Client names. A user should be able to select an existing client, which will then update the scope property:

Controller

2条回答
  •  走了就别回头了
    2021-01-31 02:59

    This is also a solution to keep parameters into your $scope object:

    controller:

    $scope.scope = $scope;
    $scope.clients = [];
    $scope.existingClient = $scope.clients.length > 0 ? $scope.clients[0] : undefined;
    

    view:

    
    

提交回复
热议问题