LemonBlue
9/22/2015 - 12:59 PM

$save 사용법 두가지

$save 사용법 두가지


    // html 에 있는 항목들을 post
  $scope.post = function() {
    $scope.building.$save(function() {
  
    });
    
    // factory 를 이용해서 html, 스크립트내의 항목 모두 저장
  $scope.post = function() {
		$scope.newPost.created_by = $rootScope.current_user;
		$scope.newPost.created_at = Date.now();
		postService.save($scope.newPost}, function(){
			$scope.posts = postService.query();
			$scope.newPost = {created_by: '', text: '', created_at: ''};
		});
	};