0

After 5hrs of struggle I decide it to ask question to see if someone can help me. I use Angular 2 for front end of application and now I have a problem to upload image on my server. Problem is after uploading because my page is reloading again. I use angular2-image-upload. In app.module i add this:

@NgModule({
    imports: [
        ...,
        ImageUploadModule.forRoot(),
        ...
    ]
})

In html file I have this:

 <image-upload
    [max]="100"
    [url]="'http://myurl'"
    [buttonCaption]="'Select Images!'"
    [dropBoxMessage]="'Drop your images here!'"
></image-upload>

And everything is ok, image was upload, but in console I got this information

[WDS] App updated. Recompiling..

and page is reloading.

Can anyone knows why this happening?

Thanks in advance

4
  • Hey can you share browser console log? Commented Jun 13, 2017 at 17:32
  • imgur.com/a/VeWrk here is link Commented Jun 13, 2017 at 17:35
  • Can't say much with that log. Probably you might be missing some imports or some issues with the observables. Just go through the code once again deeply. Hope you find. Also this might can help you as well: stackoverflow.com/questions/35985347/… Commented Jun 13, 2017 at 17:45
  • Yes, console log doesn't give any detail. In documentation is just one import, and I don't have an Observable.. :/ Commented Jun 13, 2017 at 17:51

2 Answers 2

3

Probably the reason is, Angular listens all the changes event and refresh. Your image are being uploaded inside the directory where Angular listen changes. For example, if you upload your image and move image inside Angular > src > assets (dir). It will detect changes and reloads whole application.

Consider uploading images outside the src directory. You can also read about how Angular detects changes.

Angular Change Detection - How Does It Really Work?

I know the question is asked a year ago but still if someone gets the same issue this might help.

Sign up to request clarification or add additional context in comments.

Comments

0

Issue is while image uploading , because it should not reload the page after image uploading and you are getting this message

[WDS] App updated. Recompiling..

because it reloads the whole app from beginning.

So first step is to check preserve log in console , so it will not refresh the console on page reload , it will show you the error.

7 Comments

I tried another library and I got some problem, after image success upload app is reloading. How to check preserve log in console?
But I got there only this message: [WDS] App updated. Recompiling... I thought you mean on something else
That is because your errors are being replace with this
Do you have plunker or any url so I can check?
No, but I will make, just hold on
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.