<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                取教師列表的職能應該放在teacher M層中,我們在 services/teacher.js中增加all()方法。 ``` 'use strict'; /** * @ngdoc service * @name webAppApp.teacher * @description * # teacher * Service in the webAppApp. */ angular.module('webAppApp') .service('teacher', function(server) { /** * 獲取當前頁的教師 * @param {string} name 查詢教師的名字 * @param {int} page 第幾頁 * @param {int} pageSize 每頁多少條 * @param {Function} callback 回調函數 * @return {[type]} * @author 夢云智 http://www.mengyunzhi.com * @DateTime 2017-01-21T19:05:55+0800 */ var paginate = function(name, page, pageSize, callback) { var teachers = []; // 進行http POST請求. // 由于是post請求方式,所以即便是我們在項目中存在paginate.json文件 // 但如果我們查看控制臺,仍然會發現有錯誤產生,同時,沒有正確的接收到數據 server.http({ method: 'POST', url: '/teacher/indexJson', data: { name: name, page: page, pageSize: pageSize } }, function(response) { teachers = response.teachers; callback(teachers); }); }; // 獲取所有的教師列表 var all = function(callback) { var teachers = []; server.http({ method: 'GET', url: '/Teacher_all.json', }, function(response) { teachers = response.teachers; callback(teachers); }); }; // Public API here return { // 獲取全部教師信息 paginate: function(name, page, pageSize, callback) { return paginate(name, page, pageSize, callback); }, all: all, }; }); ``` ## 單元測試 同樣,在有后臺的數據支持的情況下,我們只需要給出測試值即可 ``` 'use strict'; describe('Service: teacher', function() { // load the service's module beforeEach(module('webAppApp')); // instantiate service var teacher, $httpBackend, config; // 引用$httpBackend beforeEach(inject(function(_teacher_, _$httpBackend_, _config_) { teacher = _teacher_; $httpBackend = _$httpBackend_; config = _config_; var url = config.apiRootPath + '/Teacher_all.json'; var data = {code: 200, teachers: []}; $httpBackend.when('GET', url).respond(data); })); it('應該取出來所有的教師數據', function() { teacher.all(function(teachers) { console.log(teachers); }); // 模擬數據請求 $httpBackend.flush(); }); }); ``` # C與M對接 ``` 'use strict'; /** * @ngdoc function * @name webAppApp.controller:KlassAddCtrl * @description * # KlassAddCtrl * Controller of the webAppApp */ angular.module('webAppApp') .controller('KlassAddCtrl', function($scope, config, teacher) { $scope.name = ''; // 名稱 // 教師列表 $scope.teachers = []; // 選中的教師 $scope.teacher = 0; $scope.isDebug = config.isDebug; var submit = function() { console.log('submit'); }; // 獲取教師列表 var getTeachers = function() { teacher.all(function(response){ $scope.teachers = response; // 獲取到的所有教師 $scope.teacher = $scope.teachers[0].id; // 初始化選中的教師 }); }; // 初始化 var int = function () { getTeachers(); }; int(); $scope.submit = submit; }); ``` > git checkout -f step12.2.4
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看