angularjs simple tip service with bootstrap alert style
dependencies :
- bootstrap 3+
- angularjs 1.3+
bower install ngTip --save
then include the dist/ngTip.js and dist/ngTip.css in your html
- require
ngTipmodule
angular.module('myApp',['ngTip'])-
add
<ng-tip></ng-tip>under your<body> -
use
ngTipservice in the controller
angular.module('myApp').controller('DemoController',function($scope,ngTip){
$scope.openTip = function(){
ngTip.tip('tip message here','success');
};
})- change the default timeout
the default timeout is 3 seconds, you could change that in the angular.config
angular.module('myApp').config(function(ngTipProvider){
ngTipProvider.setDefaultTimeout(1000);
})
- the message you'd like to tip
- there're 4 types now:
info,success,warning,danger infois the default one. both from bootstrap alert bar style