Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8870661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:47:36+00:00 2026-06-14T17:47:36+00:00

I have an AngularJS $resource defined like this: var Menus = $resource(‘http://cafe.com/api/menus’); and a

  • 0

I have an AngularJS $resource defined like this:

var Menus = $resource('http://cafe.com/api/menus');

and a RESTful API. So when I do a GET on Menus I get this back:

<cafe>
  <collection href="http://cafe.com/api/menus" type="menus">
    <template>
      <data name="Name" prompt="Menu name" />
    </template>
    <items>
      <item href="http://cafe.com/api/menus/1">
        <link href="http://cafe.com/api/menus/1/ingredients" rel="ingredients" />
        <data name="Name" prompt="Menu name">Morning</data>
      </item>
      <item href="http://cafe.com/api/menus/2">
        <link href="http://cafe.com/api/menus/2/ingredients" rel="ingredients" />
        <data name="Name" prompt="Menu name">Happy Hour</data>
      </item>
    </items>
  </collection>
</cafe>

Question is, how do I delete menu 2? (given that it has its own hypermedia link: http://cafe.com/api/menus/2)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:47:37+00:00Added an answer on June 14, 2026 at 5:47 pm

    Assuming that you have gone from the XML to an Angular-managed array of JavaScript objects, you can use this to render your objects:

    <tr ng-repeat="cafe in cafes">
        <td>{{cafe.name}}</td>
        <td>
            <button class="btn" ng-click="deleteCafe($index, cafe)">Delete</button>
        </td>
    </tr>
    

    and in your controller you can do this:

    function ListCtrl($scope, $http, CafeService) {
      CafeService.list(function (cafes) {
        $scope.cafes = cafes;
      });
    
      $scope.deleteCafe = function (index, cafe) {
        $http.delete(cafe.self).then(function () {
          $scope.cafes.splice(index, 1);
        }, function () {
          // handle error here
        });
      }
    }
    

    Look, no client-side creation of URLs! 🙂

    update: fixed a bug in the splice command, was splice(index, index), but should be splice(index, 1).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a route setup like this: var myApp = angular.module('myApp', []). config(['$routeProvider', function
I have routes set in AngularJS like this: $routeProvider .when('/dashboard', {templateUrl:'partials/dashboard', controller:widgetsController}) .when('/lab', {templateUrl:'partials/lab',
I have a certain angularjs service below.. angular.service('SubmitPayment', function($resource){ return $resource('api/SubmitPayment', {}, { query:
I use AngularJS in my single-page application. Somewhere I have defined a button like
I'm using the jasmine maven plugin and my pom.xml looks like this: <plugin> <groupId>com.github.searls</groupId>
I have this AngularJS code trying to show two stars next to label when
I'm new to angularjs and python and I have this problem. I've been trying
This is a basic HTTP question and doesn't fully relate to AngularJS, but since
http://jsfiddle.net/kz26/kH9wg/ I'm playing around with directives in AngularJS and have trying both the shorthand
I have a web page with a module defined (myModule) where I'm boostraping angularjs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.