茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    Angularjs實(shí)現(xiàn)多個(gè)頁面共享數(shù)據(jù)的方式
    來源:易賢網(wǎng) 閱讀:1640 次 日期:2016-07-15 15:28:30
    溫馨提示:易賢網(wǎng)小編為您整理了“Angularjs實(shí)現(xiàn)多個(gè)頁面共享數(shù)據(jù)的方式”,方便廣大網(wǎng)友查閱!

    本文給大家介紹使用Angularjs實(shí)現(xiàn)多個(gè)頁面共享數(shù)據(jù)的方式,通過定義一個(gè)共享服務(wù)service來實(shí)現(xiàn)此功能,對(duì)angularjs共享數(shù)據(jù)相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)

    使用service來共享數(shù)據(jù)

    定義一個(gè)共享服務(wù)的service

    //家電維修共享數(shù)據(jù)的服務(wù) 

    angular.module("sqhApp").factory("repairDeviceDataShareServer",function($http,$state,$ionicPopup){ 

    return { 

    //緩存當(dāng)前需要維修的設(shè)備名稱、數(shù)量、唯一標(biāo)識(shí) 

    deviceRepairObj : [], 

    //小區(qū)位置 

    xiquLocation:{}, 

    //預(yù)約時(shí)間 

    appointmentDate:{ 

    "date":"", 

    "time":""

    }, 

    //預(yù)約日期界面回退到上一個(gè)界面的記錄 

    appointmentBackPage:"", 

    //獲取地址回退界面記錄 

    locationBackPage:"", 

    //家電維修描述 

    questionDesc:"", 

    //確認(rèn)預(yù)約 

    confirmAppointment : function(resultJson){ 

    var url = "/index.php/Wap/Homemake/createRepairOrder.html"; 

    var p = $http.post(url,resultJson); 

    p.success(function(response,header,config,status){ 

    //提交訂單成功 

    if(response.status == 0){ 

    //提示需要選擇設(shè)備 

    var alertPopup = $ionicPopup.alert({ 

    title: '家電維修', 

    template: response.msg 

    }); 

    alertPopup.then(function(res) { 

    $state.go("appliance_index"); 

    }); 

    }else{ 

    //提示需要選擇設(shè)備 

    var alertPopup = $ionicPopup.alert({ 

    title: '家電維修', 

    template: response.msg 

    }); 

    alertPopup.then(function(res) { 

    }); 

    }); 

    }, 

    //確認(rèn)預(yù)約提交的數(shù)據(jù) 

    formData:{} 

    }; 

    });

    跳轉(zhuǎn)到一個(gè)新的頁面,將repairDeviceDataShareServer注入到controller中

    //預(yù)約時(shí)間控制器 

    angular.module("sqhApp").controller("orderDateController", ["$scope", "$state", 

    '$ionicPopup', 'repairDeviceDataShareServer','appointmentDateService', 

    function ($scope, $state, $ionicPopup,repairDeviceDataShareServer,appointmentDateService) { 

    $scope.lists=[]; 

    //從服務(wù)器獲取時(shí)間 

    appointmentDateService.getAppointmentDateList($scope); 

    //回退到上一個(gè)頁面 

    $scope.back = function(){ 

    var backPage = repairDeviceDataShareServer.appointmentBackPage; 

    //如果沒有記錄值,則跳轉(zhuǎn)到家電清洗服務(wù)包目錄 

    if(backPage == ""){ 

    $state.go("appliance_index"); 

    }else{ 

    $state.go(backPage); 

    //選擇時(shí)間 

    $scope.selectTime = function(myevent){ 

    var currentObj = $(myevent.target); 

    currentObj.closest("div.time_list").find(".line_height_35px").removeClass("bg_fdd000 color_e5005a").addClass("bg_ff"); 

    currentObj.addClass("bg_fdd000 color_e5005a").removeClass("bg_ff"); 

    }; 

    //選擇日期 

    $scope.selectDate = function(myevent){ 

    var currentObj = $(myevent.target); 

    currentObj.closest("div.overflow_hidden").find("div.float_left").removeClass("color_e5005a"); 

    currentObj.closest("div.float_left").addClass("color_e5005a"); 

    }; 

    //確認(rèn)時(shí)間日期 

    $scope.confirmDateTime = function(){ 

    var selectObjs = $(".bg_f8f8f8 .color_e5005a"); 

    //獲取日期對(duì)象 

    var dateObj = $(selectObjs[0]); 

    if(dateObj.length == 0){ 

    alert("請(qǐng)選擇日期"); 

    return false; 

    //獲取時(shí)間對(duì)象 

    var timeObj = $(selectObjs[1]); 

    if(timeObj.length == 0){ 

    alert("請(qǐng)選擇時(shí)間"); 

    return false; 

    //repairDeviceDataShareServer.appointmentDate.date = dateObj; 

    repairDeviceDataShareServer.appointmentDate.date = "2016-6-6"; 

    repairDeviceDataShareServer.appointmentDate.time = timeObj.html(); 

    this.back(); 

    }; 

    }]);

    跳轉(zhuǎn)到一個(gè)新的頁面中,然后重置repairDeviceDataShareServer里面的數(shù)據(jù)

    angular.module("sqhApp").controller("applianceIndexController", ["$scope", "$state","repairDeviceDataShareServer","applianceWashShareServer", function ($scope, $state, repairDeviceDataShareServer,applianceWashShareServer) { 

    //初始化家電維修共享數(shù)據(jù) 

    repairDeviceDataShareServer.deviceRepairObj = []; 

    repairDeviceDataShareServer.xiquLocation = {}; 

    repairDeviceDataShareServer.appointmentDate = {"date":"","time":""}; 

    repairDeviceDataShareServer.appointmentBackPage = {}; 

    repairDeviceDataShareServer.locationBackPage = {}; 

    repairDeviceDataShareServer.formData = {}; 

    repairDeviceDataShareServer.questionDesc = ""; 

    //初始化家電清洗共享數(shù)據(jù) 

    applianceWashShareServer.washType=""; 

    applianceWashShareServer.formData={}; 

    applianceWashShareServer.goodsSelected=[]; 

    }]);

    關(guān)于本文給大家分享的Angularjs實(shí)現(xiàn)多個(gè)頁面共享數(shù)據(jù)的方式就給大家介紹這么多,希望對(duì)大家有所幫助!

    更多信息請(qǐng)查看網(wǎng)絡(luò)編程
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2026上岸·考公考編培訓(xùn)報(bào)班

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)