Created
June 23, 2014 20:44
-
-
Save wuxiaoying/f118fd6bbfbb89e497d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extendsScope_module = angular.module 'classy-extends', ['classy-core'] | |
### | |
Note that this does NOT get the mixin class dependencies as of now. | |
### | |
extendsScope_module.classy.plugin.controller | |
name: 'extends' | |
localInject: ['$controller'] | |
baseClasses: [] | |
options: | |
enabled: true | |
ignore: ['constructor', 'init', 'initScope'] | |
isActive: (klass, deps) -> | |
if @options.enabled and klass.mixins | |
if !deps.$scope | |
throw new Error "You need to inject `$scope` to use the watch object" | |
return false | |
return true | |
preInitBefore: (classConstructor, classObj, module) -> | |
if classObj.isBaseClass | |
@baseClasses.push classObj.name, classConstructor | |
if baseClassName = classObj.extends | |
# No controller here | |
@$controller baseClassName | |
return | |
preInit: (classConstructor, classObj, module) -> | |
if baseClass = @baseClasses[classObj.extends] | |
classConstructor extends baseClass | |
return | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment