• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
kRouter
 

kRouter

on

  • 333 views

AngularJS router without location.hash.

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

Statistics

Views

Total Views
333
Views on SlideShare
333
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    kRouter kRouter Presentation Transcript

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

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