Show the search request and outcome together on one screen

At the moment, I have a two-page application where users can input data on one page and then submit it. The next page displays the query results in a grid format as shown below:

home.html

https://i.sstatic.net/jbdr1.jpg

<form name="homeForm">
<div class="form-group col-md-6 md-padding">
    <div>
        <label style="font-size: medium">From Date</label>
        
        ...
        
    </div>

    
    <div>
        <label style="font-size: medium">To Date</label>
        
        ...

    </div>

    <div class="md-padding col-md-6">
        <div class="row form-group">
            <button type="button" class='btn btn-danger' ng-click="clearRequest(homeForm)">Clear</button>
            
            ...
            
            <button type="button" class="btn btn-success" href="Views/Angular/results.html" ng-click="createRequest(homeForm)">Submit</button>
        </div>
    </div>
</div>
</form>

result.html https://i.sstatic.net/heYkX.jpg

<div>
 <h4 class="text-primary">Search Results</h4>

    ...
    
 </div>
 </div>

Now, I want to consolidate both the query inputs/buttons and the result grid onto a single page - placing the inputs on the left and the grid on the right.

You can view the code on Plunker by following this link: here

Should I create another HTML page that combines these elements, and then call it in the app.js file? As someone new to AngularJS, I'm uncertain about how to go about this process.

Answer №1

A great approach would be to develop a view component that integrates your two components, making them the child components of the recently added view element.

For more insights on this technique, take a look at this tutorial.

Answer №2

If you're looking to streamline your web page and avoid unnecessary loading of different pages, consider utilizing Asynchronous XHTML And JavaScript (AJAX) to keep everything on a single page. This approach is ideal unless specific requirements dictate the need for displaying results on separate pages.

Since your submit button has the attribute type=button, it suggests that AJAX functionality was likely intended to prevent the page from reloading upon clicking the button.

To implement this, simply utilize the createRequest() function to send query parameters (likely found within the homeForm argument) to the query service. Once the response is received, update the gridOptions.data with the desired values for display in the table. Angular framework should handle the rest seamlessly.

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

Unable to fetch Twitter data using AJAX

Currently, I'm working on a web page that aims to display tweets from a specific city based on a user's search topic. The Twitter request is being sent successfully, with a response code of 200, and the response data is visible in the Chrome deve ...

Try out multer to handle file uploads within an Express Router

I have successfully developed a REST API using node.js and Express. Now, I need to implement a file-upload endpoint that can accept uploaded files and process them. In addition, I am utilizing an Express Router along with some Authentication middleware i ...

Importing types from a private npm module with FlowTypes

Currently I am in the process of developing a private npm package for internal use. One challenge I am facing is how to include flowtypes that can be shared across different internal projects. Ideally, I would like these flowtypes to be imported in the for ...

Exploring the functionalities of MongoDB through Populate, Aggregate, and Un

My user model contains the following data structure: { _id: object, name: string, quotes: [ { quote: string, createdAt: date } ], friends: [ { _id: object } ] (referring to the _id from the user model) } My goal is to extract and return the following ...

Is there an npm module available that can automate a daily task at a specified time in a Node.js environment?

Searching for an NPM Module to integrate into a Node.js application that can send notifications via email and SMS daily at 9am local time. Any suggestions or solutions would be greatly appreciated! ...

Achieve this effect by making sure that when a user scrolls on their browser, 50% of the content is entered into view and the remaining 50%

Is there a way to achieve this effect? Specifically, when the user scrolls in the browser, 50% of the content is displayed at the top and the other 50% is shown at the bottom. ...

transferring various data from JavaScript page to PHP page

Is it possible to pass multiple values from a service page to a PHP page? I am trying to pass the values 'data', 'albimg' and 'albvideo' to the PHP page, but I keep encountering an error. Please refer to the image below for mo ...

Only certain fields are returned by JQuery's form serialize() method

Encountering an issue with the serialize() function in jQuery when attempting to submit a serialized form via AJAX. Some of the field values are not being retained. Suspecting a problem with either my HTML structure or jQuery code: <div id="register" ...

I'm attempting to retrieve external XML data and showcase it on my HTML page

My goal is to extract any xml tag from the provided sample. However, I am facing an issue with Internet Explorer where I can only retrieve data from the first record. What kind of javascript code should I implement to resolve this problem? <html> ...

The significance of the dollar sign in ReactJs

Why is the $ symbol placed after the 'add' and 'tab' in the activeKey and the tab in the given code snippet? addNum=0; onAdd=()=> { this.addNum++; let panes=Array.from(this.state.panes); let activeKey=`add$ { this.addNum ...

What are the specific circumstances in which the onerror and ontimeout properties are utilized? (regarding

When utilizing the XMLHttpRequest class to send payload data from a web client to a web server, I encounter some common errors that need to be handled... REQUEST TIMEOUT (CONNECTION TIMEOUT) 500, INTERNAL SERVER ERROR 502, BAD GATEWAY 503, SERVICE UNAVAI ...

What is the best way to retrieve the final value from a specific property within a JSON object using Angular

I have a chat application that uses the following JSON data: { "561c": [{ "from": "561c", "fromname": "ryan", "to": "sasa", "message": "hey" }, { "from": "5512", "fromname": "sasa", "to": "ry ...

Is it ever considered safe to manually relocate a DOM node rendered by Vue? If so, when?

I am aware of the risks associated with manually manipulating DOM nodes rendered by a Vue component, such as: Vue overriding changes after another render Potential interference with Vue's patching algorithm My specific scenario involves wanting to m ...

managing access and navigation in an angular program using a boolean variable

In order to restrict and redirect access to specific routes in my angular application, I am looking for the simplest solution that works with the current versions of angular and firebase. Previous solutions have become outdated due to the continuous evolut ...

Selecting options with a click of a button in Template-Driven Forms

Whenever the page loads, I always notice that the last radio button is automatically checked. I believe it has something to do with the Id attribute, but I'm struggling to find a solution. countryArray countryA = [{name : "Finland"}, {name : "china" ...

Is it possible to call a Node.js function from JavaScript using a <script> tag in a Jade template?

I have been working on developing a blog using Node.js, Express, and MongoDB. In the template for creating a new post, there are fields for both a title and a slug. To generate slugs, I am utilizing the Slugs for Node.js library from NPM: https://npmjs.or ...

Error: When attempting to submit to MondoDB, a TypeError occurred stating that property '_id' cannot be created on the number '1'

After retrieving 25 new comments in JSON format from a subreddit, my code converts it to a string, removes special characters, and generates a dictionary to track word frequency. The challenge lies in deciding whether to treat each word as a separate entry ...

Element with adhesive properties alters its color at a particular location

I need the sticky element to change colors at specific points and then revert back to its original color. The color should be orange initially, green on block 2, and orange again on block 3. For the complete code and to address any issues with jQuery, pl ...

Displaying Dynamic Content Based on Selected Menu

I am currently delving into Angular and attempting to create a navbar menu that dynamically sets the 'active' class based on the current page. index.html <html lang="en" data-ng-app="Afe" class="no-js"> <head> <!-- cod ...

Capturing mouse coordinates from hover events in Highcharts Gantt using the highcharts-react library

Currently, I am utilizing the official React highcharts wrapper to create a Gantt chart. My goal is to obtain precise mouse coordinates from a mouse-over event and utilize them for a custom tooltip. For instance: https://stackblitz.com/edit/react-c5mivs ...