-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
56 lines (47 loc) · 1.48 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<html lang='es'>
<head>
<meta charset='utf-8'>
<title>my first backbone</title>
<link rel='stylesheet' href='http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/css/bootstrap.min.css'>
</head>
<body>
<div class='container'>
<h1>User Management</h1>
<hr/>
<div class='page'>
</div>
</div>
</body>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.1/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js'></script>
<script>
var Users = Backbone.Collection.extend({
url:'/users'
})
var UserList = Backbone.View.extend({
el: '.page',
render: function(){
var that = this;
var users = new Users();
users.fetch({
success: function() {
that.$el.html('CONTENT SHOULD SHOW HERE!');
}
})
}
});
var Router = Backbone.Router.extend({
routes: {
'':'home'
}
});
var userList = new UserList();
var router = new Router();
router.on('route:home',function(){
console.log('show on console');
userList.render();
});
Backbone.history.start();
</script>
</html>