jessleenyc / vimeo

The vimeo project allows users to pick the duration of time they can set aside towards watching well-curated videos. After the user selects their amount of time, they are able to choose different categories of interest or pick 'random' for a series of videos curated to the amount of time they have allotted.
1 stars 1 forks source link

Trying to get page to appear refreshed in anguar #9

Open jessleenyc opened 8 years ago

jessleenyc commented 8 years ago

Hi Phil,

I feel like I'm missing a big piece of this puzzle---I have an angular http request grabbing information but after I grab it, I want the information to render or be removed from the same page. I can't get it to work with jquery and I've tried doing a get request to another route by using (.then). Neither have worked.

Any hints would be great--like what exactly to google. I also tried $window.location.href="/". Thanks!

phlco commented 8 years ago

Hi Jess, can you point me to where you're trying to do this?

jessleenyc commented 8 years ago

yes! in my registercontroller--he's a snippet.

register.login = function(data, cb) {
    console.log('callback function', data);
    $http
      .post('/login', data)
      .then(function(response) {
        //after a user registers, they are immediately signed in. However, i want the index ejs to reflect the change--registration from should be removed and login should be replaced with logout. it will only render if i refresh
      })
  }
phlco commented 8 years ago

make sure you put your code blocks on separate lines!

phlco commented 8 years ago

Have you tried to assign the data to a model or change some state in your controller. like "register.isLoggedIn = true" and then evaluate on that?