Ionic Framework:在对主机进行表单post后,无法导航回我的应用程序


Ionic Framework : Can't navigating back to my app after doing form-post to my hosting

我有一个应用程序,通过使用下面的代码上传照片到主机:

<div style="background:black" class="item item-body">
                <img ng-src="http://m.fxlegato.com/profileImages/{{datauser.email}}.jpg" align="center" style="height:80%;width:80%;margin-left:auto;margin-right: auto;display:block;">
                <form action="{{ 'http://m.fxlegato.com/profileImages/upload.php?email=' + datauser.email}}" method="post" enctype="multipart/form-data">
                    <input type="file" class="light" name="fileToUpload" id="fileToUpload" accept="image/x-png, image/gif, image/jpeg" />
                    <input type="submit" class="button button-positive button-block" value="Upload Image" name="submit">
                </form>
            </div>

当上传按钮被按下时,一条来自my Upload .php的消息出现了。照片上传成功了,但是当我在。php消息中时,我无法回到我的应用程序。这个问题出现在我添加人行横道到我的应用程序后。如果我不使用人行横道,所有工作都很完美。

如何解决这个问题?

IHMO,基本的HTML表单,与基本的action不是一个很好的解决方案,用于混合应用程序。

既然你要上传一个文件,你应该考虑使用一个专用的库,比如下面两个:

  • https://github.com/nervgh/angular-file-upload
  • https://github.com/danialfarid/ng-file-upload

还有一些教程可以做这类事情。下面是一个例子:

  • https://blog.nraboy.com/2015/01/upload-files-remote-server-using-ionic-framework/