Closed nrc0004 closed 7 years ago
What console error are you getting?
function BlogIndexController($state, Blog){
this.blogs = Blog.query()
this.newBlog = new Blog()
this.create = function(){
this.newBlog.$save().then(function(blog){
//add a console log (console log blog, dog) here, see if it fires
$state.go("BlogIndex", {title: blog.title})
})
}
}
Nothing >.>
On Apr 5, 2017, at 11:32 AM, James Reichard notifications@github.com wrote:
function BlogIndexController($state, Blog){ this.blogs = Blog.query() this.newBlog = new Blog() this.create = function(){ this.newBlog.$save().then(function(blog){ //add a console log (console log blog, dog) here, see if it fires $state.go("BlogIndex", {title: blog.title}) }) } } — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ga-wdi-exercises/project4/issues/466#issuecomment-291899895, or mute the thread https://github.com/notifications/unsubscribe-auth/AXqfmRI9rRU5cyf64O1-Uq3XAFmdvPn-ks5rs7QSgaJpZM4M0acY.
jk it was just slow— it is saying there is an empty response
POST http://localhost:4000/api/blogs net::ERR_EMPTY_RESPONSE (anonymous) @ angular.js:11630 n @ angular.js:11423 g @ angular.js:11133 (anonymous) @ angular.js:15757 $eval @ angular.js:17025 $digest @ angular.js:16841 $apply @ angular.js:17133 (anonymous) @ angular.js:24813 Pf @ angular.js:3417 d @ angular.js:3405
On Apr 5, 2017, at 11:32 AM, James Reichard notifications@github.com wrote:
function BlogIndexController($state, Blog){ this.blogs = Blog.query() this.newBlog = new Blog() this.create = function(){ this.newBlog.$save().then(function(blog){ //add a console log (console log blog, dog) here, see if it fires $state.go("BlogIndex", {title: blog.title}) }) } } — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ga-wdi-exercises/project4/issues/466#issuecomment-291899895, or mute the thread https://github.com/notifications/unsubscribe-auth/AXqfmRI9rRU5cyf64O1-Uq3XAFmdvPn-ks5rs7QSgaJpZM4M0acY.
what response is the back end returning?
[nodemon] restarting due to changes...
[nodemon] starting node index.js
Listening on 4000
make some programs
(node:55075) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html http://mongoosejs.com/docs/promises.html
On Apr 5, 2017, at 12:25 PM, James Reichard notifications@github.com wrote:
what response is the back end returning?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ga-wdi-exercises/project4/issues/466#issuecomment-291916987, or mute the thread https://github.com/notifications/unsubscribe-auth/AXqfmTbuM3y5cw5a8UZ3qkDSNDFEWTXrks5rs8CBgaJpZM4M0acY.
You're using Express right? My thought was that the response (most likely res
, the local variable in the callback) is sending an empty response.
I am. I'm also no longer receiving any errors, its just not redirecting. It's def capturing the data, it just isnt redirecting/ refreshing the index page so I can immediately see it.
what about that console.log from earlier, is that firing?
Its not
Got it! I just took out the state.go (...)and replaced it with $state.current, {}, {reload: true} and it works now. Thanks :)
:+1:
Repo: https://github.com/nrc0004/project4
I am having issues getting my page to refresh when I hit submit on the "add a new blog" form. Here is the relevant code. Also, I should note the addNew function works, I just have to refresh the page manually to get it to show up and I would like it to reload or appear as soon as I hit submit.
Blog Index.html
{{blog.content}}