Open changtimwu opened 9 years ago
This is what we failed to do
When implementing conditional features, we want to:
1. Load only the code for features that the current user can access.
2. Limit access to specific parts of the controller/view.
when met peerDependency
error
please uninstall all related generators first
npm uninstall -g generator-angular
npm uninstall -g generator-karma
try gulp-angular generator it includes quite a lot good stuff including ui-router
excellent q
explain
http://blog.begin.com.tw/?p=30
window.intabctl = ($scope, $q, $timeout)->
slowadd = (a,b)->
qj = $q.defer()
$timeout (->
if a+b<20
qj.resolve a+b
else
qj.reject 'over 20'
), 5000
qj.promise
slowadd(7,8).then( (sum)->
console.log('sum is ', sum)
slowadd( 1,2)
).then( (sum)->
console.log('sum is ', sum)
slowadd( 4,5)
).then( (sum)->
console.log('sum is ', sum)
)
#parallel
pms= [slowadd( 7,8), slowadd(8,1)]
$q.all(pms).then (answers)->
console.log 'all done',answers
insightful https://ruby-china.org/topics/27590#reply7
sequential promise examples http://www.codeducky.org/q-serial/ http://jsfiddle.net/changtimwu/czU8L/3/
$q.serial
can't provide the same interface as $q.all
because a task would started upon creating the promise. This violates the term serial
whick implies a task would be started only after previous task has done.
https://github.com/alamgird/angular-next-starter-kit seems a good project demostrating how to combine angular1/typescript/webpack/karma but its karma is empty.