加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angular ionic 入门

发布时间:2020-12-17 09:58:56 所属栏目:安全 来源:网络整理
导读:在定义自己创建的模块需要引入"ionic"模块 //自己创建的hkApp模块,依赖ui.router和 ionic这两个模块angular.module("hkApp",["ui.router","ionic"]).config(function($stateProvider,$urlRouterProvider) {$stateProvider//进入设置界面.state('setting_ind

在定义自己创建的模块需要引入"ionic"模块

//自己创建的hkApp模块,依赖ui.router和 ionic这两个模块
angular.module("hkApp",["ui.router","ionic"])
.config(function($stateProvider,$urlRouterProvider) {
	$stateProvider
		//进入设置界面
		.state('setting_index',{
			url: '/setting/index',templateUrl: 'setting/setting_index.html',//ui-router的控制器引用其他service的方法,参数$state只能在$scope后面,否则会报错
			controller: ["$scope","$state",function ($scope,$state) {

				//显示数据内容
				$scope.formData = {};
				//给数据内容赋值
				$scope.formData.mobile = "18229886770";

				//添加编辑用户名事件
				$scope.editUserName = function () {
					$state.go('setting_edit_username');
				};
				/添加显示地址内容事件
				$scope.showAddress = function () {
					$state.go('setting_edit_address');
				};
				//跳转到编辑手机号码页面
				$scope.editPhone = function () {
					$state.go('setting_edit_phone');
				};
			}]
		})
})

由于ionic模块已经包含了“ui.router”这个功能,因此不需要再次引入“ui.router”模块了

修改办法:

angular.module("hkApp",["ionic"])
.config(function($stateProvider,$state) {

			}]
		})
})

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读