Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
angular-ladda
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Custom Issue Tracker
Custom Issue Tracker
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
angularjs
angular-ladda
Commits
e7ca71de
Commit
e7ca71de
authored
Aug 03, 2018
by
bingchuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev]0.2.2
parents
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
124 additions
and
0 deletions
+124
-0
bower.json
bower.json
+34
-0
angular-ladda.js
dist/angular-ladda.js
+90
-0
No files found.
bower.json
0 → 100644
View file @
e7ca71de
{
"name"
:
"angular-ladda"
,
"version"
:
"0.2.2"
,
"homepage"
:
"https://github.com/remotty/angular-ladda"
,
"authors"
:
[
"Chungsub Kim <subicura@subicura.com>"
],
"description"
:
"An angular directive wrapper for Ladda."
,
"main"
:
"dist/angular-ladda.min.js"
,
"keywords"
:
[
"ladda"
,
"loading"
,
"button"
,
"angular"
,
"angularjs"
,
"directive"
],
"license"
:
"MIT"
,
"ignore"
:
[
"**/.*"
,
"protractor.conf.js"
,
"gulpfile.js"
,
"bower_components"
,
"node_modules"
],
"dependencies"
:
{
"angular"
:
">= 1.2.0"
,
"ladda"
:
"~0.9.3"
},
"devDependencies"
:
{
"bootstrap"
:
"~3.3.1"
,
"angular-bootstrap"
:
"~0.12.0"
}
}
dist/angular-ladda.js
0 → 100644
View file @
e7ca71de
/*! angular-ladda 0.2.2 */
/**!
* AngularJS Ladda directive
* @author Chungsub Kim <subicura@subicura.com>
*/
/* global Ladda */
/* exported Ladda */
(
function
(
root
,
factory
)
{
'use strict'
;
var
Ladda
;
if
(
typeof
exports
===
'object'
)
{
// CommonJS module
// Load ladda
try
{
Ladda
=
require
(
'ladda'
);
}
catch
(
e
)
{}
module
.
exports
=
factory
(
Ladda
);
}
else
if
(
typeof
define
===
'function'
&&
define
.
amd
)
{
// AMD. Register as an anonymous module.
define
(
function
(
req
)
{
// Load ladda as an optional dependency
var
id
=
'ladda'
;
try
{
Ladda
=
req
(
id
);
}
catch
(
e
)
{}
return
factory
(
Ladda
);
});
}
else
{
root
.
Ladda
=
factory
(
root
.
Ladda
);
}
}(
this
,
function
(
Ladda
){
'use strict'
;
angular
.
module
(
'angular-ladda'
,
[])
.
provider
(
'ladda'
,
function
()
{
var
opts
=
{
'style'
:
'zoom-in'
};
return
{
setOption
:
function
(
newOpts
)
{
angular
.
extend
(
opts
,
newOpts
);
},
$get
:
function
()
{
return
opts
;
}
};
})
.
directive
(
'ladda'
,
[
'ladda'
,
function
(
laddaOption
)
{
return
{
restrict
:
'A'
,
priority
:
-
1
,
link
:
function
(
scope
,
element
,
attrs
)
{
element
.
addClass
(
'ladda-button'
);
if
(
angular
.
isUndefined
(
element
.
attr
(
'data-style'
)))
{
element
.
attr
(
'data-style'
,
laddaOption
.
style
||
'zoom-in'
);
}
// ladda breaks childNode's event property.
// because ladda use innerHTML instead of append node
if
(
!
element
[
0
].
querySelector
(
'.ladda-label'
))
{
var
labelWrapper
=
document
.
createElement
(
'span'
);
labelWrapper
.
className
=
'ladda-label'
;
angular
.
element
(
labelWrapper
).
append
(
element
.
contents
());
element
.
append
(
labelWrapper
);
}
// create ladda button
var
ladda
=
Ladda
.
create
(
element
[
0
]
);
// add watch!
scope
.
$watch
(
attrs
.
ladda
,
function
(
loading
)
{
if
(
loading
||
angular
.
isNumber
(
loading
))
{
if
(
!
ladda
.
isLoading
())
{
ladda
.
start
();
}
if
(
angular
.
isNumber
(
loading
))
{
ladda
.
setProgress
(
loading
);
}
}
else
{
ladda
.
stop
();
// When the button also have the ng-disabled directive it needs to be
// re-evaluated since the disabled attribute is removed by the 'stop' method.
if
(
attrs
.
ngDisabled
)
{
element
.
attr
(
'disabled'
,
scope
.
$eval
(
attrs
.
ngDisabled
));
}
}
});
}
};
}]);
}));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment