【问题标题】:How to get the particular data from a database and project the value in the dropdown menu in angularjs如何从数据库中获取特定数据并在 angularjs 的下拉菜单中投影值
【发布时间】:2015-08-31 14:49:13
【问题描述】:

HTML

<select id="releasetype" 
        name="releasetype" 
        ng-model ="changelog.releaseType" 
        class="form-control" 
        ng-options="releaseType.category as releaseType.category for releaseType in releaseTypes">

控制器

$scope.releaseTypes = changelogFactory.getCategories;

【问题讨论】:

    标签: javascript angularjs express mean


    【解决方案1】:

    使用

    在控制器中

    $scope.releaseTypes = [];
    changelogFactory.getCategories(function(data){
        $scope.releaseTypes = data;
    });
    

    在工厂

    return getCategories(callback){
       $http.get()
          .success(data){ 
             callback(data)
          }
    }
    

    【讨论】:

      猜你喜欢
      • 2015-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-18
      • 1970-01-01
      • 2021-02-01
      • 2018-11-26
      • 1970-01-01
      相关资源
      最近更新 更多