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

  • SEARCH
  • Home
  • 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 9331623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T06:21:59+00:00 2026-06-19T06:21:59+00:00

This seems like a question that would have already been asked, but I couldn’t

  • 0

This seems like a question that would have already been asked, but I couldn’t find quite what I was looking for, so I’ll just go ahead and ask.

I’m trying to use angular.js to make an instant search function on my site. I want users to be able to search through Posts (by title and content, ideally) instantaneously, so after hearing about angular’s ability to do this, I gave it a shot.

I have this going on in my posts.js.coffee file:

@PostListCtrl = ($scope, $http) ->
  $http.get("posts.json").success (data) ->
    $scope.posts = data

And this going on in the JSON doc it references (just to make sure it was working — which it is).

data =
    [
    name: "Blog ex"
    content: "This is my example post."
    ,
    name: "Test posting"
    content: "A different ex post"
    ,
    name: "Test3"
    content: "This has some unusual, unique vocabulary."
    ]

Now all I have left to do is get Rails to save an object (with name/content attributes) in the above JSON file each time a new Post is created, so that the search actually runs through meaningful data. I’m new to Rails/JSON/computer stuff and don’t have a clue how to do this. I’m guessing it’s in the posts controller, maybe in one of those respond_to blocks, but if anyone could point me to the right way to do this, I’d appreciate it.

  • 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-19T06:22:00+00:00Added an answer on June 19, 2026 at 6:22 am

    If all you want is an instant search, or autocomplete functionality, you should not use Angular.js or any other JS MVC frameworks. Instead, consider using jQuery as @charliefl suggested, it’s easy. A simple Ajax call will do it.

    JS MVC frameworks are heavy, and you need to design the architecture from the bottom to suit them. Not worthy for such a single functionality.

    To make this function work in jQuery, basically:

    1. Listen the event on search box, say typing one or more characters
    2. Catch the characters and use jQuery Ajax to send a POST request to a method in PostsController in Rails, say “search”
    3. Make this method respond to JSON.
    4. Update DOM according to server response.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seems like this is the kind of thing that would have already been answered
I know it seems like this question has been asked a million times, but
This seems like a newbie question except that I've been trying to wrap my
There are many questions like this but I can't find one that seems to
This seems like a simple question, but has proven to be difficult to find
This seems like the simplest Git question, but I can't find ANYTHING on it.
Alright, I know questions like this have probably been asked dozens of times, but
I'm pretty sure that this question already has been answered somewhere. It just seems
This seems like a repeated question but i'm not able to get my answer.
This seems like a basic question, but I haven't found any clear answers. Essentially,

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.