2016-10-11 2 views
0

Я новичок в Угловом и сейчас я должен найти ответ на свой вопрос через 4 часа с помощью Google)Как исправить области видимости вспомогательного элемента в моем контроллере

Это моего контроллер

var user = AuthService.getUser(); 
$http.get("http://hannation.me/api/userplus/activities/", { 
    params: { 
    key: '57f211a0354d7', 
    comment: true, 
    cookie: user.cookie, 
    user_id: user.data.id 
    } 
}).success(function(data) { 
    $scope.activities = data.activities; 
    $scope.activities.comments = []; 
    $scope.activities.comments = data.activities.comments; 
    $ionicLoading.hide(); 
    $scope.$broadcast('scroll.refreshComplete'); 
}); 

Этих мой HTML

 <div class="list card activity-card" ng-repeat="activity in activities"> 
     <div class="item item-avatar"> 
     <img src="{{activity.user.avatar_thumb}}"> 
     <div class="activity-header"> 
      <h2>{{activity.user.username}}</h2> 
      <p>{{activity.time}}</p> 
     </div> 
     </div> 
     <div class="item item-body"> 
     <div ng-bind-html='activity.content | limitHtml2 | limitHtml3' class="activity-content"> </div> 
     </div> 
     <div class="list card" ng-repeat="comment in activities.comments"> 
     <div class="item item-avatar"> 
     <img src="{{comment.avatar}}"> 
     <div class="activity-header"> 
      <p>{{comment.content}}</p> 
     </div> 
     </div> 

     </div> 
    <div class="item item-body activity-footer"> 
     <a ui-sref="app.tabs.activity-single({id :activity.activity_id})" class="button button-full button-assertive"> 
    <i>More</i> 
      </a>  
    </div> 
    </div> 

это мой файл JSON

{ 
    "activity_id": "914", 
    "component": "blogs", 
    "action": "mr. Whale wrote a new post, Mountain", 
    "content": "Let the seasons guide your way to an unforgettable vacation in the North Carolina mountains. Spring brings crisp, fresh air perfect for hiking the Appalachian Trail or biking the trails at Rocky Knob Mountain Bike [&hellip;] <img src=\"http://hannation.me/wp-content/uploads/2016/10/winter_snow_nature_landscape_1900x1200-792x500.jpg\"/>", 
    "user": [ 
    { 
     "user_id": 1, 
     "username": "adminara", 
     "avatar": "http://hannation.me/wp-content/uploads/avatars/1/57f4791724d01-bpthumb.jpg", 
     "display_name": "mr. Whale" 
    } 
    ], 
    "type": "new_blog_post", 
    "time": "2016-10-06 05:30:43", 
    "time_since": "5 days, 3 hours ago", 
    "is_hidden": false, 
    "is_spam": false, 
    "is_fav": false, 
    "can_delete": true, 
    "comments": [ 

    { 
     "id": 916, 
     "component": "activity", 
     "user_id": 5, 
     "avatar": "http://hannation.me/wp-content/uploads/avatars/5/57777a4e865b4-bpthumb.jpg", 
     "content": "И @adminara, ты специально выбрал описание про северную Каролину? Я же там год жил!", 
     "action": "RT posted a new activity comment", 
     "item_id": 914, 
     "secondary_item_id": 914, 
     "is_fav": false, 
     "can_delete": true, 
     "date_recorded": "2016-10-10 23:55:21", 
     "time_since": "8 hours, 48 minutes ago", 
     "hide_sitewide": "0", 
     "display_name": "RT", 
     "depth": 1, 
     "is_spam": "0", 
     "children": [], 
     "mptt_left": "4", 
     "mptt_right": "5" 
    }, 
    { 
     "id": 917, 
     "component": "activity", 
     "user_id": 1, 
     "avatar": "http://hannation.me/wp-content/uploads/avatars/1/57f4791724d01-bpthumb.jpg", 
     "content": "жосмлдомсочмочясмдосмдлоячсдлмодлывфывыф", 
     "action": "mr. Whale posted a new activity comment", 
     "item_id": 914, 
     "secondary_item_id": 914, 
     "is_fav": false, 
     "can_delete": true, 
     "date_recorded": "2016-10-11 01:49:19", 
     "time_since": "6 hours, 54 minutes ago", 
     "hide_sitewide": "0", 
     "display_name": "mr. Whale", 
     "depth": 1, 
     "is_spam": "0", 
     "children": [], 
     "mptt_left": "6", 
     "mptt_right": "7" 
    }, 
    { 
     "id": 918, 
     "component": "activity", 
     "user_id": 1, 
     "avatar": "http://hannation.me/wp-content/uploads/avatars/1/57f4791724d01-bpthumb.jpg", 
     "content": "@rtwest Да вообще не видно не фига! До этого все было видно)", 
     "action": "mr. Whale posted a new activity comment", 
     "item_id": 914, 
     "secondary_item_id": 914, 
     "is_fav": false, 
     "can_delete": true, 
     "date_recorded": "2016-10-11 01:49:51", 
     "time_since": "6 hours, 54 minutes ago", 
     "hide_sitewide": "0", 
     "display_name": "mr. Whale", 
     "depth": 1, 
     "is_spam": "0", 
     "children": [], 
     "mptt_left": "8", 
     "mptt_right": "9" 
    } 
    ] 
}, 

Как я могу исправить $ scope для элемента моей страницы Комментарий с ng, и пользователь как один? Я пытаюсь работать по-другому, и это не сработает. Как работает подэлемент работы $ scope? Можете ли вы, ребята, показать мне пример или просто показать мне, где у меня ошибка. Я теряю больше времени, чтобы найти решение для этого.

+0

'activities' нет такого свойства –

+0

проверить ответ –

ответ

0

В успех обратного вызова,

$scope.user= data.user; 

В HTML

<img src="{{user.avatar_thumb}}"> 
     <div class="activity-header"> 
      <h2>{{user.username}}</h2> 
+0

Это не работает –

Смежные вопросы