관리 메뉴

세줄코딩

angular toastr 본문

Programming language/Angularjs(1.x)

angular toastr

개발 hello-world 2017.01.24 21:00

간단한 알림창~ 

좋네~


github: https://github.com/Foxandxss/angular-toastr


demo: http://codeseven.github.io/toastr/demo.html


- bower 로 설치

bower install angular-toastr

- npm 으로 설치

npm install angular-toastr




1. success

app.controller('foo', function($scope, toastr) {
  toastr.success('Hello world!', 'Toastr fun!');
});


2. info

app.controller('foo', function($scope, toastr) {
  toastr.info('We are open today from 10 to 22', 'Information');
});


3. error

app.controller('foo', function($scope, toastr) {
  toastr.error('Your credentials are gone', 'Error');
});


4. warning

app.controller('foo', function($scope, toastr) {
  toastr.warning('Your computer is about to explode!', 'Warning');
});


5. no title

app.controller('foo', function($scope, toastr) {
  toastr.success('I don\'t need a title to live');
});


Closing toasts programmatically:

app.controller('foo', function($scope, toastr) {
  toastr.clear([toast]);
});



커스터 마이징~


app.config(function(toastrConfig) {
  angular.extend(toastrConfig, {
    autoDismiss: false,
    containerId: 'toast-container',
    maxOpened: 0,    
    newestOnTop: true,
    positionClass: 'toast-top-right',
    preventDuplicates: false,
    preventOpenDuplicates: false,
    target: 'body'
  });
});


'Programming language > Angularjs(1.x)' 카테고리의 다른 글

gulpfile.js 설정.  (0) 2017.02.08
Module.config / Module.constant / Module.run  (0) 2017.01.24
angular toastr  (0) 2017.01.24
yeoman gulp설정 - generator-yo-gulp / gulp-ng-config/  (0) 2017.01.24
ui-router 대강 정리  (1) 2017.01.20
angularjs 에서 Service/Factory  (0) 2016.10.18
0 Comments
댓글쓰기 폼