1
0
mirror of https://github.com/BoostIo/Boostnote synced 2026-01-24 14:17:14 +00:00

add list/show routes

This commit is contained in:
Rokt33r
2015-06-09 03:21:58 +09:00
parent 5ad5da47d2
commit f2daf5e9f4
12 changed files with 37 additions and 24 deletions

View File

@@ -7,14 +7,16 @@ angular.module('codexen')
var snippetId = $state.params.id
Snippet.show(snippetId)
Snippet.show(snippetId, {
'include': ['Tag']
})
.success(function (data) {
vm.snippet = data.snippet
vm.snippet = data
vm.isLoaded = true
})
vm.delete = function () {
Snippet.delete(vm.snippet._id)
Snippet.delete(vm.snippet.id)
.success(function () {
$rootScope.$broadcast('snippetDeleted')
})

View File

@@ -7,13 +7,13 @@ angular.module('codexen')
var loadSnippets = function () {
if ($auth.isAuthenticated) {
console.log($auth.getPayload())
var userId = $auth.getPayload().sub
Snippet.findByUser(userId)
Snippet.findMine({
'include': ['Tag']
})
.success(function (data) {
console.log('snippets fetched', data.snippets)
console.log('snippets fetched', data)
vm.isLoaded = true
vm.snippets = data.snippets
vm.snippets = data
vm.isGuest = false
})
}else {