pinkyjie / angular1-webpack-starter Goto Github PK
View Code? Open in Web Editor NEWComponent based Angular(1.x) web development with Webpack and ES6.
License: MIT License
Component based Angular(1.x) web development with Webpack and ES6.
License: MIT License
不好意思,又来麻烦了,请教一个问题:我没有使用你封装好的RouterHelper,而是采用普通的在config中配置自己的项目,但是在需要登录的界面使用一个resolve:{ Login: ['LoginResolve', function(LoginResolve){return LoginResolve.login();}]}
这样的resolve,相比你的{loginResolve: self.Resolve.login}
确实很丑,但是angular.config的resolve要注入service没有办法,结果竟然无法工作。
发现是ResolveService.prototype.login.$inject = ['UserAPI', '$q'];
这个UserAPI和$q都没有注入进来。我修改了一下这个LoginResolve类,可以正常工作了:
class LoginResolve {
constructor (UserAPI, $q){
Object.assign(this, {UserAPI, $q});
}
login () {
const self = this;
if (self.UserAPI.isLoggedIn() !== true) {
return self.UserAPI.checkLoggedInStatus()
.catch(_error);
}
function _error () {
return self.$q.reject('requireLogin');
}
}
}
LoginResolve.$inject = ['UserAPI', '$q'];
为什么你采用self.Resolve.login
就可以使用login
的inject,而我采用LoginResolve.login()
则必须将注入放到LoginResolve
再通过login来使用,LoginResolve.login()
不会触发login的依赖注入工作吗?非常感谢!
It seems Github Pages dose not support folders prefixed with _
.
Links like this http://pinkyjie.com/angular1-webpack-starter/coverage/app/components/_common/directives/index.html will return 404.
Need to cover the following pages:
Try to achieve 100% unit test coverage.
Need to cover the following folders:
IE needs to include babel shim file.
请教一个问题:
看到把stateProvider包装到一个自己的Provider中,然后在run函数中就可以定义路由,顺带登录认证一起做了,感觉流程简单了不少。但是我直接run一个function A,A中inject[‘$stateProvider‘],却会报错:Error: [$injector:unpr] Unknown provider: $stateProviderProvider <- $stateProvider。
run不能注册provider这是事实,请问你的方式为什么可行呢?
npm start
[email protected] start /home/Desktop/github/angular1-webpack-starter
webpack-dev-server --mock
events.js:141
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE 0.0.0.0:8080
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at Server._listen2 (net.js:1237:14)
at listen (net.js:1273:10)
at net.js:1382:9
at nextTickCallbackWith3Args (node.js:452:9)
at process._tickCallback (node.js:358:17)
at Function.Module.runMain (module.js:444:11)
at startup (node.js:136:18)
at node.js:966:3
npm ERR! Linux 4.8.0-51-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: webpack-dev-server --mock
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'webpack-dev-server --mock'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular1-webpack-starter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack-dev-server --mock
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular1-webpack-starter
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular1-webpack-starter
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/Desktop/github/angular1-webpack-starter/npm-debug.log
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.