내가 만들고 확인하기 위해 지시어를 사용하여 조금 같은 일
http://plnkr.co/edit/Itm6gdFbi6P7J1LvdXj7?p=preview
지시어
// Declare the main module
var myApp = angular.module('myApp', []);
angular.module('myApp').directive('dir.showhide', function() {
return {
replace: true,
restrict: 'E',
scope: { dswitch: "=",
dshowmessage: '@' , // the message displayed in the button
dhidemessage :'@', // the message displayed in the button
dshowmessagehover: '@' , //the message displayed on hover the button
dhidemessagehover :'@'},//the message displayed on hover the button
plain : true ,
template: '<div> <button class="btn btn-default btn-xs" type="button" ng-click="dswitch=true" ng-hide="dswitch" tooltip-popup-delay="500" '+
'tooltip-placement="right" uib-tooltip="{{dshowmessagehover}}"> <span class="glyphicon glyphicon-eye-open">{{dshowmessage}}</span> </button>'+
' <button class="btn btn-default btn-xs" type="button" ng-click="dswitch=false" ng-hide="!dswitch" tooltip-popup-delay="500" tooltip-placement="right" '+
' uib-tooltip="{{dhidemessagehover}}"> <span class="glyphicon glyphicon-eye-close">{{dhidemessage}}</span> </button> </div>',
controller: function ($scope) {
}
}
});
myApp.controller('Ctrl1', ['$scope', function($scope) {
$scope.showdata = false ;
$scope.dataToShow = "I am looking to develop a dashboard in Angular JS and looking for inputs,I have a reference as shown in screen shot below ,I highlighted the buttons that expand and show the detail view,I want to develop something similar to that,what this button called in ANGULAR JS?any pointers or docs are very much appreciated .A list of all buttons or UI related things would be very helpful";
$scope.showdata2 = false ;
$scope.dataToShow2 = "I am looking to develop a dashboard in Angular JS and looking for inputs,I have a reference as shown in screen shot below ,I highlighted the buttons that expand and show the detail view,I want to develop something similar to that,what this button called in ANGULAR JS?any pointers or docs are very much appreciated .A list of all buttons or UI related things would be very helpful";
}]);
그리고 html 코드 :
<dir.showhide dswitch="showdata" dshowmessage="hide" dshowmessagehover="Hide the data" dhidemessage="show" dhidemessagehover="Show the data" ></dir.showhide>
<div ng-hide="showdata">
{{dataToShow}}
</div>
물론 맞춤화해야합니다.
@Alainlb - 감사합니다. 확대하는 동안 어떤 종류의 텍스트가 표시되는지 알려주는 버튼 옆에 텍스트를 추가하고 싶습니다. 어떻게이 코드에 추가 할 수 있습니까? –
나는 코드를 업데이트했다. 호버 툴팁이 플래너에서 작동하지 않습니다. – AlainIb