2014-02-19 2 views
0

가 갖는 작동하지 않습니다 -backbone.js 라우터 - 간단한 예제

default.html을

<html> 
<head> 
</head> 
<body> 
    <script src="jquery-2.1.0.min.js"></script> 
    <script src="json2.min.js"></script> 
    <script src="underscore.js"></script> 
    <script src="backbone.js"></script> 
     <script> 
      Router = Backbone.Router.extend({ 
       routers: { 
        "*action" : "func" 
       }, 
       func: function (action) { 
        console.log(action); 

       } 
      }); 

      new Router(); 
      Backbone.history.start(); 
     </script> 

</body> 
</html> 

#console에 접미사를 인쇄 할 수있는 routers 형식에 따라.

예를 들어 경로 default.html#hello의 경우 consolehello을 인쇄해야하지만 실제로 인쇄되지는 않습니다.

무엇이 잘못 되었나요?

답변