changtimwu / changtimwu.github.com

Tim's testing/practice notes
7 stars 2 forks source link

angular advance study #17

Open changtimwu opened 9 years ago

changtimwu commented 9 years ago
changtimwu commented 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.
changtimwu commented 9 years ago

remove # hashtag http://stackoverflow.com/questions/22102815/how-to-delete-sign-in-angular-ui-router-urls

changtimwu commented 9 years ago

when met peerDependency error please uninstall all related generators first

npm uninstall -g generator-angular
npm uninstall -g generator-karma
changtimwu commented 9 years ago

try gulp-angular generator it includes quite a lot good stuff including ui-router

changtimwu commented 8 years ago

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
changtimwu commented 8 years ago

insightful https://ruby-china.org/topics/27590#reply7

changtimwu commented 8 years ago

nice angular resource

changtimwu commented 8 years ago

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.

changtimwu commented 8 years ago

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.