How to pass multiple parameters when making a factory call in AngularJS

Hey there, I have a factory below:

App.factory("myRepository", ['$resource', function($resource) {
    return {
        myRecord: $resource('api/inst/Getinst/:id,name', { last: '@id', name: '@name' }, { query: { method: 'GET' } })
    };
}]);

I am facing an issue when trying to pass two parameters named id and name in the URL. It's not working as expected. Could you please guide me on how to successfully pass multiple parameters with the URL? Thank you!

Answer №1

Here's a solution for you:

$resource('api/inst/Getinst/:id/:name', { last: '@id', name: '@name' }, { query: { method: 'GET' } })

You can find an example on the official Angular Resource documentation that may be helpful.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What web browsers encounter issues when storing XMLHTTPRequest responses in the cache?

Are there any potential issues with caching XMLHttpRequest responses in current browsers that I should take into consideration? I want to use XMLHttpRequest queries on each page to dynamically load relevant content (such as JSON) or behavior (like eval()e ...

Launching an Electron Window and Recording the Closing Event

I am currently developing a Desktop Application using Electron. I want to implement a feature where clicking on a button in the main window (index.html) will open a different window. After researching, I discovered the BrowserWindow from the Electron API. ...

What is the method for implementing an Inset FAB with Material UI in a React project?

Currently, I am working on a project that requires an "Inset Fab" button to be placed between containers. After referencing the Material Design documentation, I discovered that the component is officially named "Inset FAB". While I was able to find some tu ...

Creating a dynamic form where input fields and their values update based on user input in jQuery

In my form, I have an input field where users will enter an ISBN number. Based on the input number, I need to populate two other input fields: one for book title and one for author name. I am currently calling a JavaScript function on the onblur event of ...

Three.js - creating transparent materials that only display the background, not the inner sides of objects

I am interested in applying a transparent material to the front-side faces of a geometry. It's a fairly simple process: var normal = new THREE.MeshNormalMaterial(); normal.side = THREE.BackSide; var materials = [ norma ...

call a custom form submission using jquery first, followed by a regular form submission

Is it possible to attach a submit() handler to a form in order to execute an ajax request, and then have the form submit itself normally once the request is complete? Using $('#myForm').submit() seems to just result in the same function being cal ...

Please refrain from clearing the text field as it will delete the input value

I feel like I must be overlooking something really minor because I just can't seem to find it! I've been attempting to sanitize the text input by setting the state to ('') and while it clears the variable, the HTML input keeps displayi ...

I am experiencing issues with the search feature in angular and node.js that is not functioning properly

Need assistance with debugging this code. I am currently working on adding search functionality to my Angular web page. However, when testing the code in Postman, I keep receiving the message "NO USER FOUND WITH USERNAME: undefined". Additionally, on the w ...

Displaying a MySQL blob image in an HTML file with Vue.js: A step-by-step guide

Here is a Vue file that I have: export default { data(){ return{ info: { name: '', image: '', }, errors: [] } }, created: function(){ thi ...

jQuery counter no longer updates when scrolling

I'm having trouble with my jQuery counting function when using the scroll feature on a specific div ID. The numbers freeze if I keep scrolling before they finish updating on the screen. Whenever I scroll to the defined div ID, the counting function k ...

Tips for loading a repeater on a div scroll instead of relying on the browser window scroll

Currently, I have a repeater that loads records as I scroll down the main browser window. However, I am looking to enhance this functionality by adding a scrollable div and loading the repeater data as I scroll down that specific div, instead of the entire ...

What would be the benefit of separating the express and app components?

Every time I look at an Express app, these two lines catch my eye. const express = require('express'); const app = express(); I always wonder if any parameters can be passed to express(). After checking here, I didn't find any. https://e ...

`Weaving together and executing several animations using THREE.GLTFLoader in the world of three.js`

After exporting an animated model (spaceship) and an animated camera as a .glb file from Blender using the gltfExporter, I successfully viewed them in the glTF viewer (gltf-viewer.donmccurdy.com), confirming that the issue does not lie with the model or Bl ...

How to creatively position custom arrows in a React JS Nuka Carousel

Seeking assistance on properly positioning custom arrows within the Nuka Carousel component. After combining the decorators, I found that both of my arrows are appearing side by side. How can I address this issue? My goal is to have one arrow positioned in ...

Step-by-step guide on generating and showcasing an event exclusively using the Calendar Strip React Native npm module

I recently started exploring the world of React Native and Expo, and I have been diving into the documentation for Calendars in React Native and Expo. During my research, I came across a fantastic npm package called Calendar Strip that caught my attention. ...

Prevent screen from loading without JavaScript using an overlay

Is there a way to darken and lock the page, preventing clicking or scrolling, while displaying white text notifying the user that JavaScript is not enabled? I understand that the recommended approach is to gracefully degrade all elements when JavaScript i ...

Utilize AJAX to parse an HTML Table retrieved from an ASP page and extract targeted cell data

Within our work intranet, there exists an ASP page that retrieves data from a variety of sensors. This data is organized in a table format with multiple rows and columns. It struck me as interesting to showcase some of these outputs on our department&apos ...

The JQuery click handler seems to only be functioning on the initial item

I am currently working on a table where I need to create a functionality that can change a value in the database for each row. However, I am facing an issue where the changes I make only affect the specific row in the table and not the rest of the rows. M ...

Include an expand and collapse icon in a hyperlink

I have successfully implemented a functionality whereby clicking a link collapses other hidden names. However, I am now facing a challenge in trying to change an image once the link is clicked. Here is the code snippet that I currently have: $(docu ...

What is the best way to add information stored in localStorage to an element on the webpage?

At the moment, I am developing a Bookmark manager that stores data in localstorage and then adds the saved data from localstorage to the DOM. However, I am facing an issue where the code inside fetchUrl() is not getting appended to the DOM. Here is what I ...