ng-重复在 UIKIT 下拉列表中不起作用



我有 uikit 下拉模板,我正在尝试在其中添加 ng-reapet,但下拉不起作用。

伙计们请帮忙.....

 <div class="uk-button-dropdown" uk-dropdown="{mode:'click'}">
     <button class="md-btn">Click me <i class="material-icons">&#xE313;</i></button>
         <div class="uk-dropdown">
             <ul class="uk-nav uk-nav-dropdown">
                 <li ng-repeat="item in locationName">
                     <a href="">{{item}}</a>
                 </li>
            </ul>
         </div>
    </div>

模块

var addlocationModule = angular.module('addLocationApp', ['ngDialog']);    
addlocationModule.controller('addLocationController', function ($scope, $http, $window, ngDialog) {

    $scope.initialize = function(alllocation,loggedInEmployee) 
    {
            $scope.alllocations = alllocation;
            $scope.loggedInEmployee = loggedInEmployee;
            $scope.locationName = [];
            $scope.alllocations.forEach(function(resource) {
            $scope.locationName.push(resource.title);
            });

    }
    $scope.addLocations = function() {
          $http.post('/addLocationName',$scope.location).then(function successCallback(response) {
            if(response.data.status){
              $scope.alllocations.push(response.data.location);
              $scope.location.name="";
              $scope.location.description="";
              }
          }, function errorCallback(response) {
            // called asynchronously if an error occurs
            // or server returns response with an error status.
          })
    }
    });

你应该在ul标签中添加ng-repeat

<ul class="uk-nav uk-nav-dropdown" ng-repeat="item in locationName">
    <li>
        <a href="">{{item}}</a>
    </li>
</ul>

我想这会对你有所帮助。

最新更新