Tôi muốn thực hiện một sửa đổi nhỏ đối với chỉ thị của bên thứ 3 (cụ thể là Angular UI Bootstrap ). Tôi chỉ muốn thêm vào phạm vi của panechỉ thị:
angular.module('ui.bootstrap.tabs', [])
.controller('TabsController', ['$scope', '$element', function($scope, $element) {
// various methods
}])
.directive('tabs', function() {
return {
// etc...
};
})
.directive('pane', ['$parse', function($parse) {
return {
require: '^tabs',
restrict: 'EA',
transclude: true,
scope:{
heading:'@',
disabled:'@' // <- ADDED SCOPE PROPERTY HERE
},
link: function(scope, element, attrs, tabsCtrl) {
// link function
},
templateUrl: 'template/tabs/pane.html',
replace: true
};
}]);
Nhưng tôi cũng muốn cập nhật Angular-Bootstrap với Bower. Ngay sau khi tôi chạy bower update, tôi sẽ ghi đè các thay đổi của mình.
Vậy làm cách nào để mở rộng chỉ thị này một cách riêng biệt với thành phần bower này?
$provide.decorator(), hãy xem câu trả lời của tôi bên dưới.