This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(alert): move logic to controller & add tests
* Add missing tests that `close` button is actually visible Tests were passing even if link function was empty.
- Loading branch information
Showing
2 changed files
with
18 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
angular.module("ui.bootstrap.alert", []).directive('alert', function () { | ||
angular.module("ui.bootstrap.alert", []) | ||
|
||
.controller('AlertController', ['$scope', '$attrs', function ($scope, $attrs) { | ||
$scope.closeable = 'close' in $attrs; | ||
}]) | ||
|
||
.directive('alert', function () { | ||
return { | ||
restrict:'EA', | ||
controller:'AlertController', | ||
templateUrl:'template/alert/alert.html', | ||
transclude:true, | ||
replace:true, | ||
scope: { | ||
type: '=', | ||
close: '&' | ||
}, | ||
link: function(scope, iElement, iAttrs) { | ||
scope.closeable = "close" in iAttrs; | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters