【问题标题】:a simple select input is not working properly with angular-meteor一个简单的选择输入不能与 angular-meteor 一起正常工作
【发布时间】:2015-08-24 21:51:15
【问题描述】:

这是一件很奇怪的事情:

使用 angular-meteor 库

在页面上放一个简单的选择输入:

<div id="category">
<select ng-model="selectedItem">
<option ng-repeat="p in inputCategories" value="{{p.name}}"></option>
</select>
</div>

select 本身显示出来,它有正确数量的选项,但实际的选项文本是不可见的!

检查时显示如下:

<select class="ng-pristine ng-valid ng-touched" ng-model="selectedItem">

    <option value="? undefined:undefined ?"></option>
    <!--

     ngRepeat: p in inputCategories 

    -->
    <option class="ng-scope" value="Cost Source Actuals" ng-repeat="p in inputCategories"></option>
    <!--

     end ngRepeat: p in inputCategories 

    -->
    <option class="ng-scope" value="Cost Source Budget" ng-repeat="p in inputCategories"></option>
    <!--

     end ngRepeat: p in inputCategories 

    -->
    <option class="ng-scope" value="Chart of Accounts" ng-repeat="p in inputCategories"></option>
    <!--

     end ngRepeat: p in inputCategories 

    -->
    <option class="ng-scope" value="Cost Center Master" ng-repeat="p in inputCategories"></option>
    <!--

     end ngRepeat: p in inputCategories 

    -->
    <option class="ng-scope" value="Headcount by Department Cost Center Labor" ng-repeat="p in inputCategories"></option>
    <!--

     end ngRepeat: p in inputCategories 

    -->
    <option class="ng-scope" value="Fixed Asset Register" ng-repeat="p in inputCategories"></option>
    <!--

     end ngRepeat: p in inputCategories 

    -->
    <option class="ng-scope" value="AccountView Inventory" ng-repeat="p in inputCategories"></option>
    <!--

     end ngRepeat: p in inputCategories 

    -->
    <option class="ng-scope" value="DC Facilities" ng-repeat="p in inputCategories"></option>
    <!--

     end ngRepeat: p in inputCategories 

    -->
    <option class="ng-scope" value="GL accounts" ng-repeat="p in inputCategories"></option>
    <!--

     end ngRepeat: p in inputCategories 

    -->
    <option class="ng-scope" value="NextGen data" ng-repeat="p in inputCategories"></option>
    <!--

     end ngRepeat: p in inputCategories 

    -->
    <option class="ng-scope" value="Profit and Loss data" ng-repeat="p in inputCategories"></option>
    <!--

     end ngRepeat: p in inputCategories 

    -->
    <option class="ng-scope" value="Vendors" ng-repeat="p in inputCategories"></option>
    <!--

     end ngRepeat: p in inputCategories 

    -->

</select>

这里是控制器:

angular.module("collector").controller("CollectorCtrl", ['$scope', '$stateParams', '$meteor',
    function($scope, $stateParams, $meteor, $location){

        $scope.inputCategories = [
            {
                name: 'Cost Source Actuals'
            },
            {
                name: 'Cost Source Budget'
            },
            {
                name: 'Chart of Accounts'
            },
            {
                name: 'Cost Center Master'
            },
            {
                name: 'Headcount by Department Cost Center Labor'
            },
            {
                name: 'Fixed Asset Register'
            },
            {
                name: 'AccountView Inventory',
                collectionName: 'AccountView_Inventory'

            },
            {
                name: 'DC Facilities',
                collectionName: 'DC_Facilities'

            },
            {
                name: 'GL accounts',
                collectionName: 'GL_accounts'

            },
            {
                name: 'NextGen data',
                collectionName: 'NextGen_data'

            },
            {
                name: 'Profit and Loss data',
                collectionName: 'Profit_and_Loss_data'

            },
            {
                name: 'Vendors'
            }
        ];


    }]);

有人知道这可能是什么吗?

【问题讨论】:

    标签: angularjs select meteor angularjs-ng-repeat angular-meteor


    【解决方案1】:

    option 标签内给出的文本将显示在您的选项中。您错过了在 option 标记内添加文本。

    标记

    <select ng-model="selectedItem">
        <option ng-repeat="p in inputCategories" value="{{p.name}}">{{p.name}}</option>
    </select>
    

    【讨论】:

      猜你喜欢
      • 2016-07-28
      • 2014-06-23
      • 2015-05-06
      • 1970-01-01
      • 2023-03-07
      • 1970-01-01
      • 2017-01-18
      • 2018-11-10
      • 2014-07-01
      相关资源
      最近更新 更多