Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-loading",
"version": "0.0.1",
"version": "0.0.5",
"ignore": [
"**/.*",
"node_modules",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-loading",
"version": "0.0.1",
"version": "0.0.5",
"dependencies": {},
"devDependencies": {
"gulp": "^3.9.0",
Expand Down
2 changes: 1 addition & 1 deletion src/core/control.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ControlCtrl = [
@setOption = (option)->
if option
@$options = angular.extend({},defaultOption,option)
console.log @$options
# console.log @$options

@attend = (fn)->
if angular.isFunction fn
Expand Down
10 changes: 8 additions & 2 deletions src/core/group.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ GroupCtrl = ['$element','$attrs','$scope',(element,attrs,scope)->
return array
removeUnAttend = (name,callback)->
array = unAttendList[name]
return unless array
arrayRemove(array,callback)
return

Expand Down Expand Up @@ -70,7 +71,8 @@ GroupCtrl = ['$element','$attrs','$scope',(element,attrs,scope)->
throw new Error("same name control")
controls[name] = control
else
controls['@'].push control
name = '@'
controls[name].push control
callbacks = getAndRemoveUnAttend(name)
angular.forEach(callbacks,(v)->
control.attend(v)
Expand All @@ -90,12 +92,14 @@ GroupCtrl = ['$element','$attrs','$scope',(element,attrs,scope)->
#public

@attend=(name,callback)->
if name is '@'
throw new Error('q control name can\'t be @' )
if angular.isFunction(name)
callback = name
name = null
if !angular.isFunction(callback)
return

name = name || '@'
control = @$$getControl(name)
#no control add list
if control
Expand All @@ -111,7 +115,9 @@ GroupCtrl = ['$element','$attrs','$scope',(element,attrs,scope)->
name = null
if !angular.isFunction(callback)
return
name = name || '@'
control = @$$getControl(name)
# 如果control先调用removeControl,此处会找不到control
if control
control.unAttend(callback)
else
Expand Down
1 change: 1 addition & 0 deletions src/core/init.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ qInitDirective = ['defaultOption',(defaultOption)->
return {
restrict: 'A'
controller:"ControlCtrl"
priority:1000
require:['?^qInitOptions','qInit']
link:(scope, element, attrs,ctrls)->
console.log 'q init'
Expand Down