0
나는이 custom Drop-Down list guide을 사용하여 모든 브라우저에서 지원되는 멋진 dropdown list
이라는 각도 1.0.7을 만들었습니다. Plunk에서 볼 수있는 것처럼 모든 것이 잘 작동합니다.더블 클릭하여 커브 선택 1.2X
그런 다음 각도 1.2.x로 업그레이드하기로 결정했습니다. 새로운 각도에서 첫 번째 클릭이 항상 펼쳐지지 않고 실행되는 것 같습니다. drop-down
list
입니다. 는 내가 drop-down
다음은 각도 1.0.7
예처럼 다시 정상적으로 작동 더블 클릭 후 - Plunk
가 어떻게 할 수 내 각도 1.2.x 이전에 list
가 첫 번째 클릭을 확장하는 대신 더블 클릭 drop-down
내 application
첫 실행?
내 HTML :
<body ng-controller="VotesCtrl">
<p>This is from index.html</p>
<div dropdown="" class="{{temp}} wrapper-dropdown-3" ng-click="temp='active'">
<i class="arrow"></i>
<span>{{selected}}</span>
<ul class="dropdown">
<li ng-repeat="status in statuses">
<a ng-click="change(status)" href="#">{{status}}</a>
</li>
</ul>
</div>
</body>
내 JS :
var webApp = angular.module('webApp', []);
//controllers
webApp.controller ('VotesCtrl', function ($scope) {
$scope.statuses = ["Approved","Pending","Trash","Spam"];
$scope.selected = $scope.statuses[0];
$scope.change = function(status) {
console.log(status);
$scope.selected = status;
};
});
webApp.controller ('tempCtrl', function ($scope) {
$scope.statuses = ["Approved","Pending","Trash","Spam"];
$scope.selected = $scope.statuses[0];
$scope.change = function(status) {
$scope.selected = status;
};
});
//services
//directive
webApp.directive('dropdown', function() {
angular.element(document).click(function() {
// all dropdowns
angular.element('.wrapper-dropdown-3').removeClass('active');
});
return {
restrict: 'A',
link: function(scope, elem, attrs) {
// var dd = new DropDown(elem);
angular.element(elem).on('click', function(event) {
angular.element(this).toggleClass('active');
return false;
});
}
};
});