mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-16 19:21:52 +00:00
add Recipes(scaffolding)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/* global angular */
|
||||
angular.module('codexen')
|
||||
.controller('RecipesDetailController', function (Recipe, $state, $rootScope, $scope, Modal) {
|
||||
var vm = this
|
||||
|
||||
vm.isLoaded = false
|
||||
|
||||
var recipeId = $state.params.id
|
||||
|
||||
Recipe.show(recipeId)
|
||||
.success(function (data) {
|
||||
vm.recipe = data
|
||||
vm.isLoaded = true
|
||||
})
|
||||
|
||||
$scope.$on('taggingRequested', function (e) {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
Modal.editRecipe(angular.copy(vm.recipe))
|
||||
.then(function (recipe) {
|
||||
console.log('edited', recipe)
|
||||
}, function () {
|
||||
console.log('edit recipe modal dismissed')
|
||||
})
|
||||
})
|
||||
|
||||
$scope.$on('recipeUpdated', function (e, recipe) {
|
||||
console.log('event received', recipe)
|
||||
if (recipe.id === vm.recipe.id) vm.recipe = recipe
|
||||
})
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user