Skip to content

Instantly share code, notes, and snippets.

@alfredhot
Created December 2, 2016 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfredhot/7a0d116e434e2688e2085fbf57aa6a03 to your computer and use it in GitHub Desktop.
Save alfredhot/7a0d116e434e2688e2085fbf57aa6a03 to your computer and use it in GitHub Desktop.
JavaScript 에서 sweetalert 을 쉽게 사용하기
$rootScope.showAlert= (content, type, fn) ->
if fn is null
fn = ->
null
if type is null
swal $rootScope.popup.title, content
.then fn
else
swal $rootScope.popup.title, content, type
.then fn
$rootScope.showWarning = (content, fn) ->
$rootScope.showAlert(content, "warning", fn)
$rootScope.showError = (content, fn) ->
$rootScope.showAlert(content, "error", fn)
$rootScope.showSuccess = (content, fn) ->
$rootScope.showAlert(content, "success", fn)
$rootScope.sweet= (option,fn) ->
option.title = $rootScope.popup.title
swal option,fn
@kudowoo
Copy link

kudowoo commented May 27, 2018

fff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment