使用Cordova在iOS中使用外部源显示图像

时间:2015-04-24 06:21:48

标签: javascript ios angularjs cordova ionic-framework

我尝试做的就是在使用Ionic / Cordova / Angular的iOS模拟器中将源设置为外部位置(AWS S3)时显示以下图像:

<img src="https://miyagi-photos.s3.amazonaws.com/madeline-profile"/>


我尝试过以下操作:

1)将AmazonAWS添加到Cordova的白名单中,但我已经在第一行已经涵盖了它:

<access origin="*"/> <!-- existing -->
<access origin="*.amazonaws.*" />  <!-- added this -->

2)尝试完全删除协议:

<img src="miyagi-photos.s3.amazonaws.com/madeline-profile"/>

3)尝试使用标准http协议中的不同图像:

<img src="http://upload.wikimedia.org/wikipedia/en/b/b1/Portrait_placeholder.png"/>

4)尝试使用ng-src而不是src:

<img ng-src="https://miyagi-photos.s3.amazonaws.com/madeline-profile"/>


参考的完整页面:

<ion-view class="has-header" view-title="Create Class">
  <ion-content>
    <form>
      <div>
        <label for="ClassName">Class Name: </label>
        <input type="text" name="name" ng-model="classInformation.name" required>
      </div>

      <div>
        <label for="ClassPhoto">Class Photo: </label>
        <div class="button" ng-file-select ng-file-change="upload($files)" ng-multiple="multiple">Select File</div>
        <img src="https://miyagi-photos.s3.amazonaws.com/madeline-profile" height="150px"/>
      </div>

      <div>
        <label for="description">description: </label>
        <input type="text" name="description" ng-model="classInformation.description" required>
      </div>

      <div>
        <label for="rate">rate: </label>
        <input type="text" name="rate" ng-model="classInformation.rate" required>
      </div>

      <div>
        <label for="date">date: </label>
        <input type="text" name="date" ng-click="setDate()" ng-model="classInformation.date" required>
      </div>

      <div>
        <label for="time">time: </label>
        <input type="text" name="time" ng-click="setTime()" ng-model="classInformation.time" required>
      </div>

      <div>
        <label for="location">location: </label>
        <input type="text" name="location" ng-model="classInformation.location" required>
      </div>

      <button type="submit" value="Submit" ng-click="createClass()">Create Class</button>
    </form>
  </ion-content>
</ion-view>

1 个答案:

答案 0 :(得分:0)

重新启动Xcode后问题消失了。