Created
September 21, 2017 11:55
-
-
Save lifeart/121a54441d89f904f647bc42553a1518 to your computer and use it in GitHub Desktop.
ES6 ng 1.6 state
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
const configObject = { | |
setup() { | |
const args = this.ngConstruct(); | |
const argumentsList = Array.prototype.slice.call(arguments, 0); | |
for (let i = 0; i < args.length - 1; i++) { | |
this[args[i]] = argumentsList[i]; | |
} | |
console.log('setup!!!', typeof this['$stateProvider']); | |
this.init.apply(this,argumentsList); | |
}, | |
init() { | |
console.log(this,arguments); | |
this.$stateProvider.state('appLogin', { | |
url: '/app', | |
controller: 'appC', | |
templateUrl: 'app.html' | |
}); | |
}, | |
ngConstruct() { | |
return ['$stateProvider', this.setup.bind(this)]; | |
} | |
}; | |
export default configObject; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment