第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何在頁(yè)面加載完成之后調(diào)用angularJsr的控制器里的方法

如何在頁(yè)面加載完成之后調(diào)用angularJsr的控制器里的方法

慕前端8664132 2016-11-02 20:24:38
如何在頁(yè)面加載完成之后調(diào)用angularJsr的控制器里的方法? <!DOCTYPE html><html ng-app="kaifanla"><head>? ? <meta charset="UTF-8">? ? <title>水滴保險(xiǎn)</title>? ? <link rel="stylesheet" href="jqm/jquery.mobile-1.4.5.css"/><link rel="stylesheet" href="css/kaifanla.css"/><link rel="stylesheet" href="css/oyb2.min.css" /><link rel="stylesheet" href="csss/jquery.mobile.icons.min.css" />? ? <script src="js/jquery-1.11.3.js"></script>? ? <script src="jqm/jquery.mobile-1.4.5.js"></script>? ? <script src="js/angular.js"></script>? ? <script src="js/kaifanla.js"></script>? </head><body ng-controller="parentCtr" ><div data-role="page">? ? <div>? ? ? ? <div ng-click="jump('tpl/main.html')">? ? ? ? ? ? <h2 style="z-index:99">保險(xiǎn)讓生活更美好</h2> ?<!--目的:想在頁(yè)面加載完成之后讓此標(biāo)題做一些動(dòng)畫事件,如:跳著出來(lái)等等。我又想把這樣的方法寫在控制器里的(模塊化編程)可是沒(méi)有實(shí)現(xiàn)?-->? ? ? ? ? ? <video autoplay loop>? ? ? ? ? ? ? ? <source src="videos/spring.mp4" style="z-index:1"/>? ? ? ? ? ? </video>? ? ? ? </div>? ? </div></div></body></html><!--js代碼-->/**?* Created by Administrator on 2016/3/20.?*/angular.module('kaifanla',[]).? ? controller('parentCtr',function($scope){??? ? ? ?$scope.jump = function(routPath){? ? ? ? ? ? //$location.path(routPath);? ? ? ? ? ? console.log($)? ? ? ? ? ? $.mobile.changePage(routPath,{transition:'pop'});? ? ? ? };? ? ? ? $(document).on('pagecreate', function (event) {? ? ? ? ? ? //監(jiān)聽(tīng)到了page的創(chuàng)建? ? ? ? ? ? //console.log('page is creating....');? ? ? ? ? ? //獲取要加載到的容器? ? ? ? ? ? var page = event.target;? ? ? ? ? ? //獲取作用域?qū)ο? ? ? ? ? ? var scope = $(page).scope();? ? ? ? ? ? //獲取注入器對(duì)象? ? ? ? ? ? var injector = $(page).injector();? ? ? ? ? ? //調(diào)用注入器,為程序提供$compile服務(wù)? ? ? ? ? ? injector.invoke(function($compile){? ? ? ? ? ? ? ? //編譯并鏈接DOM節(jié)點(diǎn)? ? ? ? ? ? ? ? $compile(page)(scope);? ? ? ? ? ? ? ? scope.$digest();? ? ? ? ? ? });? ? ? ? })/*$(document).on("ready",function(){?alert(1)同樣沒(méi)有出來(lái)?})*/? ? }).controller('startCtr',function($scope){? ? }).controller('mainCtr',function($rootScope,$scope,$http){? ? ? ? /*加載數(shù)據(jù)*/? ? ? ? $scope.hasMore = true; ?//是否還有更多數(shù)據(jù)可供加載? ? ? ? //$scope.dishList = []; ?//用于保存所有商品品數(shù)據(jù)的數(shù)組? ? ? ? //控制器初始化/頁(yè)面加載時(shí),從服務(wù)器讀取最前面的5條記錄? ? ? ? $http.get('../data/dish_getbypage.php?start=0').? ? ? ? ? ? success(function(data){? ? ? ? ? ? ? ? $scope.dishList = data;//$scope.dishList.concat(data);? ? ? ? ? ? });? ? ? ? //“加載更多”按鈕的單擊事件處理函數(shù):每點(diǎn)擊一次,加載更多的5條數(shù)據(jù)? ? ? ? $scope.loadMore = function(){? ? ? ? ? ? $http.get('../data/dish_getbypage.php?start='+$scope.dishList.length).? ? ? ? ? ? ? ? success(function(data){? ? ? ? ? ? ? ? ? ? if(data.length<5){ ?//服務(wù)器返回的菜品數(shù)量不足5條? ? ? ? ? ? ? ? ? ? ? ? $scope.hasMore = false;? ? ? ? ? ? ? ? ? ? }? ? ? ? ? ? ? ? ? ? $scope.dishList = $scope.dishList.concat(data);? ? ? ? ? ? ? ? });? ? ? ? }? ? ? ? //監(jiān)視搜索框中的內(nèi)容是否改變——監(jiān)視 kw Model變量? ? ? ? $scope.$watch('kw', function(){? ? ? ? ? ? if( $scope.kw ){? ? ? ? ? ? ? ? $http.get('../data/dish_getbykw.php?kw='+$scope.kw).? ? ? ? ? ? ? ? ? ? success(function(data){? ? ? ? ? ? ? ? ? ? ? ? $scope.dishList = data;? ? ? ? ? ? ? ? ? ? })? ? ? ? ? ? }? ? ? ? });? ? ? ? $scope.showDetail=function(id){? ? ? ? ? ? $rootScope.dishid=id;? ? ? ? ? ? localStorage.setItem('id',id);? ? ? ? ? ? $scope.jump("detail.html");? ? ? ? }? ? }).controller('detailCtr',function($scope,$http,$rootScope){? ? ? ? //讀取路由URL中的參數(shù)? ? ? ? //console.log($routeParams.dishid)? ? ? ? $http.get('../data/dish_getbyid.php?id='+$rootScope.dishid).? ? ? ? ? ? success(function(data){? ? ? ? ? ? ? ? //console.log('接收到服務(wù)器返回的菜品詳情:')? ? ? ? ? ? ? ? //console.log(data);? ? ? ? ? ? ? ? $scope.dish = data[0];? ? ? ? ? ? })? ? }).controller('orderCtr',function($scope,$http,$rootScope){? ? ? ? //console.log($routeParams.dishid);? ? ? ? //定義order對(duì)象,用于保存order數(shù)據(jù)? ? ? ? $scope.order = {"did":$rootScope.dishid};? ? ? ? $scope.submitOrder = function(){? ? ? ? ? ? //$scope.succMsg = '預(yù)約成功!您的預(yù)約編號(hào)為:5。您可以在用戶中心查看訂單狀態(tài)。';? ? ? ? ? ?//$scope.errMsg = '預(yù)約失??!錯(cuò)誤碼為:404';? ? ? ? ? ? //console.log($scope.order);? ? ? ? ? ? var str = jQuery.param($scope.order);? ? ? ? ? ? console.log(str);? ? ? ? ? ? $http.get('../data/order_add.php?'+str).? ? ? ? ? ? ? ? success(function(data){? ? ? ? ? ? ? ? ? ? //console.log(data[0].msg);? ? ? ? ? ? ? ? ? ? if(data[0].msg == 'succ'){? ? ? ? ? ? ? ? ? ? ? ? $scope.succMsg = '預(yù)約成功!您的預(yù)約編號(hào)為:'+data[0].did+'。您可以在用戶中心查看訂單狀態(tài)。'? ? ? ? ? ? ? ? ? ? ? ? //記載用戶手機(jī)號(hào),用于查詢訂單? ? ? ? ? ? ? ? ? ? ? ? $rootScope.phone = $scope.order.phone;? ? ? ? ? ? ? ? ? ? }else {? ? ? ? ? ? ? ? ? ? ? ? $scope.errMsg = '預(yù)約失??!錯(cuò)誤碼為:'+data[0].reason;? ? ? ? ? ? ? ? ? ? }? ? ? ? ? ? ? ? ? ? //console.log($scope.succMsg);? ? ? ? ? ? ? ? ? ? //console.log($scope.errMsg);? ? ? ? ? ? ? ? });? ? ? ? }? ? }).controller('myorderCtr',function($scope,$http,$rootScope){? ? ? ? //console.log($rootScope.phone);? ? ? ? $http.get('../data/order_getbyphone.php?phone='+$rootScope.phone).? ? ? ? ? ? success(function(data){? ? ? ? ? ? ? ? ?$scope.orderList = data;? ? ? ? ? ? ? ? console.log(data);? ? ? ? });? ? ? ? $scope.showDetail=function(id){? ? ? ? ? ? localStorage.setItem('id',id);? ? ? ? ? ? $scope.jump('detail.html');? ? ? ? }? ? });? ? ?//window.onload=function(){alert(1)//為什么沒(méi)有出來(lái)}
查看完整描述

1 回答

?
慕用0418482

TA貢獻(xiàn)98條經(jīng)驗(yàn) 獲得超15個(gè)贊

data-ng-init

查看完整回答
1 反對(duì) 回復(fù) 2016-11-04
  • 1 回答
  • 1 關(guān)注
  • 4940 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)