如何在Ui中显示数据,如果我在控制台获得数据在angular js

how to show the data in Ui if i am getting data in console in angular js

本文关键字:数据 控制台 angular js Ui 显示 如果      更新时间:2023-09-26

我已经为这个页面写了一个html文件和相应的控制器逻辑,我在控制台获得数据,但该数据没有显示在我的UI

<div id="panelDemo14" class="panel panel-default" ng-controller="NoticeController">

     <div class="panel-heading">Enter Notice here</div>
     <div class="panel-body">
        <tabset>
            <!-- SECOND TAB -->
            <tab heading="Notice List">
                      <div class="panel panel-default" ng-controller="NoticeController "  >
     <div class="panel-body">

,,,,显示所有通知。{{gradeFilter}} {{sectionFilter}}

        <div class="row">
           <div class="col-md-12">
               <div class="box-placeholder">

                      <!-- START DATATABLE 1 -->


                                <div class="panel panel-default  {{ dataLoad }}">
                                                                        <div class="panel-heading">
                                                                             <a ng-mousedown="csv.generate()" ng-href="{{ csv.link() }}" download="test.csv" class="pull-right btn btn-sm btn-info">Export to CSV</a>
                                                                             <div ng-if="gradeFilter" class="panel-title">Classes</div>
                                                                        </div>
                                                                        <div class="table-responsive ">
                                                                           <table ng-table="table.tableParams" export-csv="csv" show-filter="true" class="table table-bordered table-striped">


                                                                               <tr ng-repeat="g in $data ">
                                                                                     <td data-title ="'Topic'" align="center" >{{g.noticeId}}</td>
                                                                                    <td data-title ="'Message'" align="center" >{{g.message}}</td>
                                                                                    <td data-title ="'Sender'" align="center" >{{ g.senderName    }} </td>
                                                                                    <td data-title ="'Date'" align="center" >{{ g.date | cmdate:'dd-MMM-yyyy' }}</td>
                                                                                    <td align="center"><a ui-sref="admin.viewEditnotice({nid : g.noticeId})">View </a></td>
                                                                                 </tr>
                                                                           </table>
                                                                        </div>
                              </div>

               </div>
           </div>

        </div>
     </div>
  </div>

和控制器文件

enter code here/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
console.log('Notice loaded');
App.controller('NoticeController', ["$scope","$http","$stateParams","Notice","toaster","APISource",function($scope,$http,$stateParams,Notice,toaster,APISource) {
  'use strict';


 $http.get(APISource.currentApiPoint+"/app/notice")
        .success(function(data){
  console.log(JSON.stringify(data))
        })
        .error(function(data)
        {
        });

将数据定义为$scope.mydata = data,然后在重复使用时定义为g in mydata

像这样设置AJAX响应到控制器模型:

$scope.$data = data