快乐学习 Ionic Framework+PhoneGap 手册1-5 {IO开关}
当然,即使努力了也没做成,至少你也有收获,因为你知道自己以后可以避开这个坑。
这是一个"IO"开关,请看效果图和代码,下一节,说明,数据交换
Index HTML Code
<!DOCTYPE html>
<html ng-app="ionicApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title> <link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet"> <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
--> <!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script> <!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script> <!-- your app's js -->
<script src="js/app.js"></script>
</head>
<body> <ion-nav-bar class="bar-positive nav-title-slide-ios7">
<ion-nav-back-button class="button-icon ion-arrow-left-c">
</ion-nav-back-button>
</ion-nav-bar> <ion-nav-view animation="slide-left-right"></ion-nav-view> <script id="templates/sign-in.html" type="text/ng-template">
<ion-view title="登录">
<ion-content>
<div class="list">
<label class="item item-input">
<span class="input-label">用户名</span>
<input type="text" ng-model="user.username">
</label>
<label class="item item-input">
<span class="input-label">密 码</span>
<input type="password" ng-model="user.password">
</label>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="signIn(user)">
立即登录
</button>
<p class="text-center">
<a href="#/forgot-password">找回密码</a>
</p>
</div>
</ion-content>
</ion-view>
</script> <script id="templates/forgot-password.html" type="text/ng-template">
<ion-view title="找回密码">
<ion-content padding="true">
<p>放弃是经线,坚持是纬线</p>
<p>没有一个谷底不可逾越</p>
<p>
返回 <a href="#/sign-in">登录</a>.
</p>
</ion-content>
</ion-view>
</script> <script id="templates/tabs.html" type="text/ng-template">
<ion-view>
<ion-tabs class="tabs-icon-top tabs-positive"> <ion-tab title="首页" icon="ion-home" href="#/tab/home">
<ion-nav-view name="home-tab"></ion-nav-view>
</ion-tab> <ion-tab title="关于" icon="ion-ios7-information" href="#/tab/about">
<ion-nav-view name="about-tab"></ion-nav-view>
</ion-tab> <ion-tab title="退出" icon="ion-log-out" href="#/sign-in">
</ion-tab> </ion-tabs>
</ion-view>
</script> <script id="templates/home.html" type="text/ng-template">
<ion-view title="首页">
<ion-content> <div class="list"> <div class="item item-divider">
设置
</div> <ion-toggle ng-repeat="item in settingsList"
ng-model="item.checked"
ng-checked="item.checked">
{{ item.text }}
</ion-toggle> <div class="item">
<pre ng-bind="settingsList | json"></pre>
</div> <div class="item item-divider">
消息通知
</div> <ion-toggle ng-model="pushNotification.checked"
ng-change="pushNotificationChange()">
是否推送消息
</ion-toggle> <div class="item">
<pre ng-bind="pushNotification | json"></pre>
</div> <ion-toggle toggle-class="toggle-assertive"
ng-model="emailNotification"
ng-true-value="{夜间模式}"
ng-false-value="{正常模式}">
模式调整
</ion-toggle> <div class="item">
<pre ng-bind="emailNotification | json"></pre>
</div> </div> </ion-content>
</ion-view>
</script> <script id="templates/facts.html" type="text/ng-template">
<ion-view title="生活圈">
<ion-content padding="true">
<h3>如果你比你身边的绝大多数人都强,那你该换朋友圈了</h3>
<p>若非青春苦短,谁会想来日方长</p>
<p>若非青春苦短,谁会想来日方长</p>
<p>
<a class="button icon ion-home" href="#/tab/home">首页</a>
<a class="button icon icon-right ion-chevron-right" href="#/tab/facts2">关于</a>
</p>
</ion-content>
</ion-view>
</script> <script id="templates/facts2.html" type="text/ng-template">
<ion-view title="关于">
<ion-content padding="true">
<h3>如果你比你身边的绝大多数人都强,那你该换朋友圈了</h3>
<p>若非青春苦短,谁会想来日方长</p>
<p>若非青春苦短,谁会想来日方长</p>
<a class="button icon ion-home" href="#/tab/home"> 首页</a>
<a class="button icon ion-chevron-left" href="#/tab/facts"> 生活圈</a>
</p>
</ion-content>
</ion-view>
</script> <script id="templates/about.html" type="text/ng-template">
<ion-view title="关于">
<ion-content padding="true">
<h3>如果你比你身边的绝大多数人都强,那你该换朋友圈了</h3>
<p>若非青春苦短,谁会想来日方长</p>
<p>若非青春苦短,谁会想来日方长</p>
<p>
<a class="button icon icon-right ion-chevron-right" href="#/tab/navstack">关于</a>
</p>
</ion-content>
</ion-view>
</script> <script id="templates/nav-stack.html" type="text/ng-template">
<ion-view title="其它">
<ion-content padding="true">
<p><img src="http://ionicframework.com/img/diagrams/tabs-nav-stack.png" style="width:100%"></p>
</ion-content>
</ion-view>
</script> </body>
</html>
App Js Code
angular.module('ionicApp', ['ionic']) .config(function($stateProvider, $urlRouterProvider) { $stateProvider
.state('signin', {
url: '/sign-in',
templateUrl: 'templates/sign-in.html',
controller: 'SignInCtrl'
})
.state('forgotpassword', {
url: '/forgot-password',
templateUrl: 'templates/forgot-password.html'
})
.state('tabs', {
url: '/tab',
abstract: true,
templateUrl: 'templates/tabs.html'
})
.state('tabs.home', {
url: '/home',
views: {
'home-tab': {
templateUrl: 'templates/home.html',
controller: 'HomeTabCtrl'
}
}
})
.state('tabs.facts', {
url: '/facts',
views: {
'home-tab': {
templateUrl: 'templates/facts.html'
}
}
})
.state('tabs.facts2', {
url: '/facts2',
views: {
'home-tab': {
templateUrl: 'templates/facts2.html'
}
}
})
.state('tabs.about', {
url: '/about',
views: {
'about-tab': {
templateUrl: 'templates/about.html'
}
}
})
.state('tabs.navstack', {
url: '/navstack',
views: {
'about-tab': {
templateUrl: 'templates/nav-stack.html'
}
}
})
.state('tabs.contact', {
url: '/contact',
views: {
'contact-tab': {
templateUrl: 'templates/contact.html'
}
}
}); $urlRouterProvider.otherwise('/sign-in'); }) .controller('SignInCtrl', function($scope, $state) { $scope.settingsList = [
{ text: "Wireless", checked: true },
{ text: "GPS", checked: false },
{ text: "Bluetooth", checked: false }
]; $scope.pushNotificationChange = function() {
console.log('Push Notification Change', $scope.pushNotification.checked);
}; $scope.pushNotification = { checked: true };
$scope.emailNotification = 'Subscribed'; $scope.signIn = function(user) {
console.log('Sign-In', user);
$state.go('tabs.home');
}; }) .controller('HomeTabCtrl', function($scope) {
console.log('HomeTabCtrl');
});
快乐学习 Ionic Framework+PhoneGap 手册1-5 {IO开关}的更多相关文章
- 快乐学习 Ionic Framework+PhoneGap 手册1-1{创建APP项目}
快乐学习 Ionic Framework+PhoneGap 手册1-1 * 前提必须安装 Node.js,安装PhoneGap,搭建Android开发环境,建议使用真机调试 {1.1}= 创建APP项 ...
- 快乐学习 Ionic Framework+PhoneGap 手册1-4 {登录页面}
编程的快乐和乐趣,来自于能成功运行程序并运用到项目中 有了面板然后加个登录页面,请看效果图和代码 Index HTML Code <!DOCTYPE html> <html ng-a ...
- 快乐学习 Ionic Framework+PhoneGap 手册1-3 {面板切换}
编程的快乐和乐趣,来自于能成功运行程序并运用到项目中,会在后面案例,实际运用到项目当中与数据更新一起说明 从面板切换开始,请看效果图和代码,这只是一个面板切换的效果 Index HTML Code & ...
- 快乐学习 Ionic Framework+PhoneGap 手册1-2{介绍Header,Content,Footer的使用}
*先运行第一个简单的APP,介绍Header,Content,Footer的使用 {2.1}运行一个简单的APP,效果如下 {2.2}Header代码 <ion-header-bar class ...
- 案例:1 Ionic Framework+AngularJS+ASP.NET MVC WebApi Jsonp 移动开发
落叶的庭院扫的一干二净之后,还要轻轻把树摇一下,抖落几片叶子,这才是Wabi Sabi的境界. 介绍:Ionic是移动框架,angularjs这就不用说了,ASP.Net MVC WebApi提供数据 ...
- 170多个Ionic Framework学习资源(转载)
在Ionic官网找到的学习资源:http://blog.ionic.io/learning-ionic-in-your-living-room/ 网上的文章比较多,但是很多时候我们很难找到自己需要的. ...
- Wijmo 5 + Ionic Framework之:费用跟踪 App
Wijmo 5 + Ionic Framework之:费用跟踪 App 费用跟踪应用采用了Wijmo5和Ionic Framework创建,目的是构建一个hybird app. 我们基于<Mob ...
- Mobile first! Wijmo 5 + Ionic Framework之:费用跟踪 App
费用跟踪应用采用了Wijmo5和Ionic Framework创建,目的是构建一个hybird app. 我们基于<Mobile first! Wijmo 5 + Ionic Framework ...
- Ionic Framework 4 介绍
Ionic Framework 4是一个开源UI工具包,用于使用Web技术(HTML,CSS和JavaScript)构建高性能的高质量移动和桌面应用程序.Ionic Framework专注于前端用户体 ...
随机推荐
- pom.xml settings.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Soft ...
- er图 画图工具
http://www.oschina.net/project/tag/83/db-model
- Python eval 作用和风险 (string 转为dict list tuple)建议用“ast.literal_eval”
a = "[[1,2], [3,4], [5,6], [7,8], [9,0]]" b = eval(a) print b [[1, 2], [3, 4], [5, 6], [7, ...
- WPF-Binding对数据的检验
设置Binding的ValidationRules属性对Binding进行检验 <StackPanel> <TextBox x:Name="txtAge" Fon ...
- poj 2117(割点的应用)
题目链接:http://poj.org/problem?id=2117 思路:题目的意思是要求对于给定的无向图,删除某个顶点后,求最大的连通分量数.显然我们只有删掉割点后,连通分支数才会增加,因此我们 ...
- poj 1698(拆点+最大匹配)
题目链接:http://poj.org/problem?id=1698 思路:最大匹配容易想到,关键是如何建图,这里我们可以将电影按需要的天数进行拆点,然后对于可以选择的日子连边,最后只需判断最大匹配 ...
- MySQL的having子句
1.定义:having子句对分组的结果集进行进一步的筛选 2.语法:select 字段列表 from 表名称 [where 子句][gruop by 子句] [having 子句]; 3.举例:查询出 ...
- Laravel中创建控制器
<?php /** * Created by PhpStorm. * User: chuang * Date: 17-1-14 * Time: 下午4:29 */ namespace App\H ...
- ASP.NET MVC 使用dataTable(3)--更多选项参考
ASP.NET MVC 使用dataTable(3)--更多选项参考 jQuery dataTables 插件是一个优秀的表格插件,是后台工程师的福音!它提供了针对数据表格的排序.浏览器分页.服务器 ...
- Android———最详细的系统对话框(AlertDialog)详解
在实际应用开发中,用到系统对话框中的情况几乎是没有的.按开发流程来说,UI工程师都会给出每一个弹窗的样式,故而在实际开发中都是自定义弹窗的. 即使用到的地方不多,但是我们也是需要了解并且能熟练的运用它 ...