AngularJS ngModel directive in select

后端 未结 2 870
梦毁少年i
梦毁少年i 2020-12-31 08:52

I am working on an angularjs project and i have a problem with the ngModel not binding within the select.But the same concept is working in another select tag a

2条回答
  •  迷失自我
    2020-12-31 09:01

    Based on Tony the Pony's fiddle :

    {{opt}}

    With a controller:

    function MyCtrl($scope) {
        $scope.fonts = [
            {title: "Arial" , text: 'Url for Arial' },
            {title: "Helvetica" , text: 'Url for Helvetica' }
        ];
        $scope.change= function(option){
            alert(option.title);
        }
    }
    

    http://jsfiddle.net/basarat/3y5Pw/43/

提交回复
热议问题