I seem to have encountered a small issue with my HomePage. I am using an NG-repeat with images in posts, but when I try to click on a post, I receive the following error:
TypeError: Cannot read property 'facebook' of undefined
at new <anonymous> (app.js:234)
at invoke (ionic.bundle.js:12877)
at Object.instantiate (ionic.bundle.js:12885)
at ionic.bundle.js:17154
at IonicModule.controller.self.appendViewElement (ionic.bundle.js:48176)
at Object.IonicModule.factory.ionicViewSwitcher.create.switcher.render (ionic.bundle.js:46392)
at Object.IonicModule.factory.ionicViewSwitcher.create.switcher.init (ionic.bundle.js:46312)
at IonicModule.controller.self.render (ionic.bundle.js:48050)
at IonicModule.controller.self.register (ionic.bundle.js:48008)
at updateView (ionic.bundle.js:53315)
Also,
GET http://127.0.0.1:8103/%7B%7BauthData.facebook.cachedUserProfile.picture.data.url%7D%7D 404 (Not Found)
This is the HTML code:
<div ng-repeat="(id,post) in posts">
<div class="card" ui-sref="tabpost({ postname: post.nameid, postdescription: post.descriptionid, postdate: post.startdateid, posthour: post.starthourid, postprice: post.priceid, postnbguest: post.nbguestid, postpicture: post.pictureid })">
<div class="item item-divider" ng-class="{{post.starthourid | setImageClass}}">
<h2 class="text stable"> {{ post.nameid }} </h2>
<h3 class="text stable" id="header-date">
<i class="icon ion-clock"></i> Le {{ post.startdateid | date : "d MMM" }} à {{ post.starthourid | date : "HH:mm" }}</p>
</div>
<div class="row">
<div class="col">
<h3><i class="icon ion-ios-location"></i> À 500m</h3></div>
<div class="col"><h3><i class="icon ion-ios-people">
</i> 2/{{ post.nbguestid }} </h3></div>
</div>
<button class="button button-stable" id="positive-btn-price" disabled>{{ post.priceid }}€</button>
<img class="imgProfilPostPositive" src="{{ post.userid.facebook.cachedUserProfile.picture.data.url }}">
<div class="item item-divider" id="footerPostNotepositive"><p> <i class="fa fa-star"></i> Popular </p> </div>
</div>
</div>
</div></div>
App JS code:
.state('tabpost', {
url: '/tabpost/:postname/:postdescription/:postdate/:posthour/:postprice/:postnbguest/:postpicture',
templateUrl: 'templates/tab-post.html',
controller: 'PostCtrl',
})
Controller JS code:
$scope.nameid = $stateParams.postname;
$scope.descriptionid = $stateParams.postdescription;
$scope.startdateid = $stateParams.postdate;
$scope.starthourid = $stateParams.posthour;
$scope.priceid = $stateParams.postprice;
$scope.nbguestid = $stateParams.postnbguest;
$scope.userid.facebook.cachedUserProfile.picture.data.url = $stateParams.postpicture;
Would appreciate any help or insights on how to pass the picture to my Post page properly. Thank you for your time.