本文介绍了Angularjs MD-选项都显示在屏幕上的检查,但不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有角的形式和我使用MD-select和MD-选项。但是,当我点击下拉菜单,冻结画面,如果我通过观察元素MD-选项看看会展示。

 < MD-NG选择模型=严重程度占位符=选择严重性>
    < MD-选择-标签> {{Severities.name}}< / MD-选择-标签>
    < MD-NG选项值=opt.idNG重复=选择在severities.availableOptions>
       {{opt.name}}
    < / MD选项>
< / MD-选择>$ scope.severities = {
    availableOptions:
    {
        编号:'1',
        名称:'名称1'
    },
    {
        ID:'2',
        名称:'名2'
    },
    {
        ID:'3',
        名称:'NAME3
     }
     ]};


解决方案

  $ scope.severities = {
     availableOptions:
           {ID:1,名称:'名称1'},
           {ID:'2',名称:'名2},
           {ID:'3',名称:'NAME3'}
]};

在模型中的 $ scope.severities.name 什么,并在 MD-选择标签您使用此这是不对的。

试试这个 -

 < MD-NG选择模型=严重程度占位符=选择严重性>
     < MD-NG选项值=opt.idNG重复=选择在severities.availableOptions>
           {{opt.name}}
      < / MD选项>
< / MD-选择>

I have angular form and I am using md-select and md-option. But when I click on dropdown, freezes the screen and if I see by inspecting element md-option will be showing.

<md-select ng-model="Severities" placeholder="Select a Severity">
    <md-select-label>{{ Severities.name }}</md-select-label>
    <md-option ng-value="opt.id" ng-repeat="opt in severities.availableOptions">
       {{ opt.name }}
    </md-option>
</md-select>



$scope.severities= {
    availableOptions: [
    {
        id: '1',
        name: 'name1'
    },
    {
        id: '2',
        name: 'name2'
    },
    {
        id: '3',
        name: 'name3'
     }
     ], };
解决方案
$scope.severities= {
     availableOptions: [
           {id: '1', name: 'name1' },
           { id: '2', name: 'name2' },
           { id: '3', name: 'name3' }
]};

In your model $scope.severities.name is nothing and in md-select-label you are using this which is wrong.

Try this -

<md-select ng-model="Severities" placeholder="Select a Severity">
     <md-option ng-value="opt.id" ng-repeat="opt in severities.availableOptions">
           {{ opt.name }}
      </md-option>
</md-select>

这篇关于Angularjs MD-选项都显示在屏幕上的检查,但不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 12:08