Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit c386744

Browse files
refact(alert): Simplify alert directive further
1 parent 7bbc176 commit c386744

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/alert/alert.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ angular.module("ui.bootstrap.alert", []).directive('alert', function () {
77
scope:{
88
type:'=',
99
close:'&'
10-
},
11-
link:function (scope, element, attrs) {
12-
scope.dismiss = function () {
13-
scope.close();
14-
};
1510
}
1611
};
1712
});

src/alert/test/alert.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ describe("alert", function () {
4949
});
5050

5151
it('it should be possible to add additional classes for alert', function () {
52-
var element = $compile('<alert class="alert-block">Default alert!</alert>')(scope);
52+
var element = $compile('<alert class="alert-block" type="\'info\'">Default alert!</alert>')(scope);
5353
scope.$digest();
5454
expect(element).toHaveClass('alert-block');
55+
expect(element).toHaveClass('alert-info');
5556
});
5657

5758
it("should fire callback when closed", function () {

template/alert/alert.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class='alert' ng-class="(type) && 'alert-'+type || undefined">
2-
<button type='button' class='close' ng-click='dismiss()'>&times;</button>
1+
<div class='alert' ng-class='type && "alert-" + type'>
2+
<button type='button' class='close' ng-click='close()'>&times;</button>
33
<div ng-transclude></div>
44
</div>

0 commit comments

Comments
 (0)