国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

angular.js - Using filter in ng-option has no effect
漂亮男人
漂亮男人 2017-05-16 13:19:07
0
1
844

I want to convert English to Chinese display in ng-option, but the filter seems to be invalid. I used uppercase but it didn't work either. Why?
I see a lot of things written like this on the Internet

The following is the code:
(1) The status list is defined in the controller:

$scope.allStatuses = ["all", "process", "resolve", "finish", "invalid"];

(2) Initialize the drop-down list in html, and want to use myStatusFilter this filter to format it for Chinese display

                    <select class="form-control"
                            style="margin-right: 20px;width: 180px;"
                            ng-model="status"
                            ng-options="status for status in allStatuses | myStatusFilter">
                    </select>

(3) filter implementation

angular.module("itil.mine")
        .filter('myStatusFilter', myStatusFilter);

    function myStatusFilter() {
        return function (input) {
            var output;
            switch (input) {
                case 'process':
                    output = "處理中";
                    break;
                case 'resolve':
                    output = "已解決為落實(shí)";
                    break;
                case 'finish':
                    output = "已解決已落實(shí)";
                    break;
                case 'invalid':
                    output = '無(wú)效';
                    break;
                case 'all':
                    output = "所有";
                    break;
            }
            return output;
        }
    }         "

       
漂亮男人
漂亮男人

reply all(1)
曾經(jīng)蠟筆沒(méi)有小新

You will know the problem after debugging the filter code. You think your parameters are objects but actually arrays, so the switch does not match the value and returns undefined directly.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template