Your SlideShare is downloading. ×
kRouter
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

kRouter

178
views

Published on

AngularJS router without location.hash. …

AngularJS router without location.hash.
https://github.com/kelp404/kRouter

Published in: Technology, Education

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
178
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. kRouter https:/ /github.com/kelp404/kRouter
  • 2. Kelp github/kelp404! iOS App Developer! Front-end Developer! Objective-C, CoffeeScript, Python
  • 3. kRouter Reason! CoffeeScript! kRouter! Unit Test! Conclusion
  • 4. kRouter SEO! location.hash `#`
  • 5. CoffeeScript
  • 6. CoffeeScript
  • 7. JavaScript https:/ /github.com/madrobby/semicolon.js
  • 8. CoffeeScript
  • 9. JavaScript } } } }
  • 10. CoffeeScript
  • 11. JavaScript return { id: 1002
 , name: ‘Kelp’
, email: ‘kelp@phate.org’
 };
  • 12. CoffeeScript id: 1002
 name: ‘Kelp’
 email: ‘kelp@phate.org’

  • 13. JavaScript function (members, name) {
 var result = [];
 for (var index = 0; index < members.length; index++) {
 if (members[index].name == name) {
 result.push(members[index]);
 }
 }
 return result;
 }
  • 14. CoffeeScript (members, name) -> x for x in members when x.name is name
  • 15. JavaScript $(function () { $(document).on(‘click’, ‘#link’, function () { var s = $(‘#text’).text(); $(this).html(‘Hello ‘ + s + ‘!!’); }); });
  • 16. CoffeeScript $ -> $(document).on ‘click’, ‘#link’, -> s = $(‘#text’).text() $(@).html “Hello #{s}!!”
  • 17. JavaScript angular.module(‘app’, []) .controller(‘HomeController’, function ($scope) { $scope.text = ‘hello’; });
  • 18. CoffeeScript a = angular.module ‘app’, [] a.controller ‘HomeController’, ($scope) -> $scope.text = ‘hello’
  • 19. CoffeeScript npm install -g coffee-script
  • 20. kRouter Routes! history.pushState()! window.onpopstate
  • 21. kRouter common.coffee! directive.coffee! module.coffee! provider.coffee
  • 22. common.coffee getUri: (href=location.href) ->! matchRoute: (url, routes) ->! parseQueryString: (queryString) ->
  • 23. directive.coffee kr-view! kr-go
  • 24. module.coffee angular.module 'kRouter', [
 'kRouter.provider', 'kRouter.directive'
 ]
  • 25. provider.coffee $kRouterProvider.register = (name, args={}) ->! routers: []! state:
 current: {}
 params: {}! go: (href, push=true) ->
  • 26. Unit Test Travis CI! karma! jasmine
  • 27. Conclusion npm install -g coffee-script! git clone https:/ /github.com/kelp404/kRouter.git
 cd kRouter
 git submodule update --init