Study Mobile Angular UI – Forms working project make money

Mobile Angular UI – Forms This chapter will focus on forms. Let us take a look at a working example to get a better understanding of forms. In index.html the code will be as follows − <!DOCTYPE html> <html> <head> <meta charset=”utf-8″ /> <title>Mobile Angular UI Demo</title> <meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″ /> <meta name=”apple-mobile-web-app-capable” content=”yes” /> <meta name=”viewport” content=”user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimal-ui” /> <meta name=”apple-mobile-web-app-status-bar-style” content=”yes” /> <link rel=”shortcut icon” href=”/assets/img/favicon.png” type=”image/x-icon” /> <link rel=”stylesheet” href=”node_modules/mobile-angular-ui/dist/css/mobile-angular-ui-hover.min.css” /> <link rel=”stylesheet” href=”node_modules/mobile-angular-ui/dist/css/mobile-angular-ui-base.min.css” /> <link rel=”stylesheet” href=”node_modules/mobile-angular-ui/dist/css/mobile-angular-ui-desktop.min.css” /> <script src=”node_modules/angular/angular.min.js”></script> <script src=”node_modules/angular-route/angular-route.min.js”></script> <script src=”node_modules/mobile-angular-ui/dist/js/mobile-angular-ui.min.js”></script> <script src=”node_modules/angular-route/angular-route.min.js”></script> <script src=”node_modules/mobile-angular-ui/dist/js/mobile-angular-ui.gestures.min.js”></script> <link rel=”stylesheet” href=”src/css/app.css” /> <script src=”src/js/app.js”></script> </head> <body ng-app=”myFirstApp” ng-controller=”MainController” class=”listening”> <!– Sidebars –> <div class=”sidebar sidebar-left “> <div class=”scrollable”> <h1 class=”scrollable-header app-name”>Tutorials</h1> <div class=”scrollable-content”> <div class=”list-group” ui-turn-off=”uiSidebarLeft”> <a class=”list-group-item” href=”/”>Home Page </a> <a class=”list-group-item” href=”#/academic”><i class=”fa fa-caret-right”></i>Academic Tutorials </a> <a class=”list-group-item” href=”#/bigdata”><i class=”fa fa-caret-right”></i>Big Data & Analytics </a> <a class=”list-group-item” href=”#/computerProg”><i class=”fa fa-caret-right”></i>Computer Programming </a> <a class=”list-group-item” href=”#/computerscience”><i class=”fa fa-caret-right”></i>Computer Science </a> <a class=”list-group-item” href=”#/databases”><i class=”fa fa-caret-right”></i>Databases </a> <a class=”list-group-item” href=”#/devops”><i class=”fa fa-caret-right”></i>DevOps </a> </div> </div> </div> </div> <div class=”sidebar sidebar-right”> <div class=”scrollable”> <h1 class=”scrollable-header app-name”>eBooks</h1> <div class=”scrollable-content”> <div class=”list-group” ui-toggle=”uiSidebarRight”> <a class=”list-group-item” href=”#/php”><i class=”fa fa-caret-right”></i>PHP </a> <a class=”list-group-item” href=”#/Javascript”><i class=”fa fa-caret-right”></i>Javascript </a> </div> </div> </div> </div> <div class=”app”> <div class=”navbar navbar-app navbar-absolute-top”> <div class=”navbar-brand navbar-brand-center” ui-yield-to=”title”> TutorialsPoint </div> <div class=”btn-group pull-left”> <div ui-toggle=”uiSidebarLeft” class=”btn sidebar-left-toggle”> <i class=”fa fa-th-large “></i> Tutorials </div> </div> <div class=”btn-group pull-right” ui-yield-to=”navbarAction”> <div ui-toggle=”uiSidebarRight” class=”btn sidebar-right-toggle”> <i class=”fal fa-search”></i> eBooks </div> </div> </div> <div class=”navbar navbar-app navbar-absolute-bottom”> <div class=”btn-group justified”> <a ui-turn-on=”aboutus_modal” class=”btn btn-navbar”><i class=”fal fa-globe”></i> About us</a> <a ui-turn-on=”contactus_overlay” class=”btn btn-navbar”><i class=”fal fa-map-marker-alt”></i> Contact us</a> </div> </div> <!– App body –> <div class=”app-body”> <div class=”app-content”> <ng-view></ng-view> </div> </div> </div><!– ~ .app –> <!– Modals and Overlays –> <div ui-yield-to=”modals”></div> </body> </html> In home/home.html <div class=”scrollable”> <div class=”scrollable-content section”> <form name=”myform” role=”form” ng-submit=”myform.$valid && addDetails()”> <fieldset> <legend>Personal Details</legend> <div class=”form-group has-success has-feedback”> <label>First Name</label> <input type=”text” ng-model=”fname” class=”form-control” placeholder=”Enter First Name” required> </div> <div class=”form-group has-success has-feedback”> <label>Last Name</label> <input type=”text” ng-model=”lname” class=”form-control” placeholder=”Enter Last Name” required> </div> <div class=”form-group has-success has-feedback”> <label>Email</label> <input type=”email” ng-model=”email” class=”form-control” placeholder=”Enter email” required> </div> </fieldset> <hr> <input class=”btn btn-primary btn-block” type=”submit” value=”Save” /> </form> </div> </div> The src/app.js will have following details − /* eslint no-alert: 0 */ ”use strict // // Here is how to define your module // has dependent on mobile-angular-ui // var app=angular.module(”myFirstApp”, [ ”ngRoute”, ”mobile-angular-ui”, ”mobile-angular-ui.gestures” ]); app.config(function($routeProvider, $locationProvider) { $routeProvider .when(“/”, { templateUrl : “src/home/home.html” }); $locationProvider.html5Mode({enabled:true, requireBase:false}); }); app.directive(”dragItem”, [”$drag”, function($drag) { return { controller: function($scope, $element) { $drag.bind($element, { transform: $drag.TRANSLATE_BOTH, end: function(drag) { drag.reset(); } }, { sensitiveArea: $element.parent() } ); } }; }]); app.controller(”MainController”, function($rootScope, $scope, $routeParams) { $scope.addDetails=function() { alert(“All details are saved!”); }; }); The display in browser is as follows − Enter the details in the form and click on the Save button. Learn online work project make money

Mobile Angular UI – Discussion

Discuss Mobile Angular UI ”; Previous Next Mobile Angular UI is an open-source framework for developing hybrid mobile apps. Mobile Angular UI makes use of Twitter Bootstrap and AngularJS that helps to create attractive HTML5 hybrid mobile and desktop apps. Print Page Previous Next Advertisements ”;

Mobile Angular UI – Toggle Switch

Mobile Angular UI – Toggle Switch ”; Previous Next Mobile Angular UI offers toggle switch elements using the ui-switch directive. The ui-switch directive makes a toggle when applied on to a Boolean ngModel value. Here is a working example of Toggle Switch. Index.html <!DOCTYPE html> <html> <head> <meta charset=”utf-8″ /> <title>Mobile Angular UI Demo</title> <meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″ /> <meta name=”apple-mobile-web-app-capable” content=”yes” /> <meta name=”viewport” content=”user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimal-ui” /> <meta name=”apple-mobile-web-app-status-bar-style” content=”yes” /> <link rel=”shortcut icon” href=”/assets/img/favicon.png” type=”image/x-icon” /> <link rel=”stylesheet” href=”node_modules/mobile-angular-ui/dist/css/mobile-angular-ui-hover.min.css” /> <link rel=”stylesheet” href=”node_modules/mobile-angular-ui/dist/css/mobile-angular-ui-base.min.css” /> <link rel=”stylesheet” href=”node_modules/mobile-angular-ui/dist/css/mobile-angular-ui-desktop.min.css” /> <script src=”node_modules/angular/angular.min.js”></script> <script src=”node_modules/angular-route/angular-route.min.js”></script> <script src=”node_modules/mobile-angular-ui/dist/js/mobile-angular-ui.min.js”></script> <script src=”node_modules/angular-route/angular-route.min.js”></script> <script src=”node_modules/mobile-angular-ui/dist/js/mobile-angular-ui.gestures.min.js”></script> <link rel=”stylesheet” href=”src/css/app.css” /> <script src=”src/js/app.js”></script> <style> a.active { color: blue; } </style> </head> <body ng-app=”myFirstApp” ng-controller=”MainController” class=”listening”> <!– Sidebars –> <div class=”sidebar sidebar-left “> <div class=”scrollable”> <h1 class=”scrollable-header app-name”>Tutorials</h1> <div class=”scrollable-content”> <div class=”list-group” ui-turn-off=”uiSidebarLeft”> <a class=”list-group-item” href=”/”>Home Page </a> <a class=”list-group-item” href=”#/academic”><i class=”fa fa-caret-right”></i>Academic Tutorials </a> <a class=”list-group-item” href=”#/bigdata”> <i class=”fa fa-caret-right”></i>Big Data & Analytics </a> <a class=”list-group-item” href=”#/computerProg”><i class=”fa fa-caret-right”></i>Computer Programming </a> <a class=”list-group-item” href=”#/computerscience”>< i class=”fa fa-caret-right”></i>Computer Science </a> <a class=”list-group-item” href=”#/databases”><i class=”fa fa-caret-right”></i>Databases </a> <a class=”list-group-item” href=”#/devops”><i class=”fa fa-caret-right”></i>DevOps </a> </div> </div> </div> </div> <div class=”sidebar sidebar-right”> <div class=”scrollable”> <h1 class=”scrollable-header app-name”>eBooks</h1> <div class=”scrollable-content”> <div class=”list-group” ui-toggle=”uiSidebarRight”> <a class=”list-group-item” href=”#/php”><i class= “fa fa-caret-right”></i>PHP </a> <a class=”list-group-item” href=”#/Javascript”><i class=”fa fa-caret-right”></i>Javascript </a> </div> </div> </div> </div> <div class=”app”> <div class=”navbar navbar-app navbar-absolute-top”> <div class=”navbar-brand navbar-brand-center” ui-yield-to=”title”> TutorialsPoint </div> <div class=”btn-group pull-left”> <div ui-toggle=”uiSidebarLeft” class=”btn sidebar-left-toggle”> <i class=”fa fa-th-large “></i> Tutorials </div> </div> <div class=”btn-group pull-right” ui-yield-to=”navbarAction”> <div ui-toggle=”uiSidebarRight” class=”btn sidebar-right-toggle”> <i class=”fal fa-search”></i> eBooks </div> </div> </div> <div class=”navbar navbar-app navbar-absolute-bottom”> <div class=”btn-group justified”> <a ui-turn-on=”aboutus_modal” class=”btn btn-navbar”><i class=”fal fa-globe”></i> About us</a> <a ui-turn-on=”contactus_overlay” class=”btn btn-navbar”><i class=”fal fa-map-marker-alt”></i> Contact us</a> </div> </div> <!– App body –> <div class=”app-body”> <div class=”app-content”> <ng-view></ng-view> </div> </div> </div><!– ~ .app –> <!– Modals and Overlays –> <div ui-yield-to=”modals”></div> </body> </html> app.js /* eslint no-alert: 0 */ ”use strict”; //n mobile-angular-ui // var app=angular. // Here is how to define your module // has dependent omodule(”myFirstApp”, [”ngRoute”, ”mobile-angular-ui”, ”mobile-angular-ui.gestures”, ]); app.config(function($routeProvider, $locationProvider) { $routeProvider .when(“/”, { templateUrl : “src/home/home.html” }); $locationProvider.html5Mode({enabled:true, requireBase:false}); }); app.controller(”MainController”, function($rootScope, $scope, $routeParams) { $scope.msg=”Welcome to TutorialsPoint!”; }); src/home/home.html <div class=”scrollable”> <div class=”scrollable-content”> <form> <h1>Testing Toogle Switch </h1> <ui-switch id=”enabled” name=”enabled” ng-model=”enabled” class=”green”></ui-switch> <p>{{ enabled }}</p> </form> </div> </div> The display in the browser is as follows − Print Page Previous Next Advertisements ”;

Mobile Angular UI – Swipe Gestures

Mobile Angular UI – Swipe Gestures ”; Previous Next The functionality like touch, swipes, dragging items is handled by the gestures module in Mobile Angular UI. The gestures module has a directive and services to take care of the functionality required in touch, swipe and drag. To work with gestures features in Mobile Angular UI, you need to add the gestures module. First add the JavaScript file inside index.html as shown below − <script src=”node_modules/mobile-angular-ui/dist/js/mobile-angular-ui.gestures.min.js”></script> Later add the gestures module as a dependency in app.js as shown below − var app=angular.module(”myFirstApp”, [ ”ngRoute”, ”mobile-angular-ui”, ”mobile-angular-ui.gestures” ]); We have already discussed how drag functionality works using the gesture module. Take a look at the same in Drag and Drop Chapter. Here will take a look at the swipe functionality. The directive uiSwipeLeft and uiSwipeRight present helps to detect the direction in which the user has swiped. Here is a working example on Swipe − index.html <!DOCTYPE html> <html> <head> <meta charset=”utf-8″ /> <title>Mobile Angular UI Demo</title> <meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″ /> <meta name=”apple-mobile-web-app-capable” content=”yes” /> <meta name=”viewport” content=”user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimal-ui” /> <meta name=”apple-mobile-web-app-status-bar-style” content=”yes” /> <link rel=”shortcut icon” href=”/assets/img/favicon.png” type=”image/x-icon” /> <link rel=”stylesheet” href=”node_modules/mobile-angular-ui/dist/css/mobile-angular-ui-hover.min.css” /> <link rel=”stylesheet” href=”node_modules/mobile-angular-ui/dist/css/mobile-angular-ui-base.min.css” /> <link rel=”stylesheet” href=”node_modules/mobile-angular-ui/dist/css/mobile-angular-ui-desktop.min.css” /> <script src=”node_modules/angular/angular.min.js”></script> <script src=”node_modules/angular-route/angular-route.min.js”></script> <script src=”node_modules/mobile-angular-ui/dist/js/mobile-angular-ui.min.js”></script> <script src=”node_modules/angular-route/angular-route.min.js”></script> <script src=”node_modules/mobile-angular-ui/dist/js/mobile-angular-ui.gestures.min.js”></script> <link rel=”stylesheet” href=”src/css/app.css” /> <script src=”src/js/app.js”></script> </head> <body ng-app=”myFirstApp” ng-controller=”MainController”> <!– Sidebars –> <div class=”sidebar sidebar-left”> <div class=”scrollable”> <h1 class=”scrollable-header app-name”>Tutorials</h1> <div class=”scrollable-content”> <div class=”list-group” ui-turn-off=”uiSidebarLeft”> <a class=”list-group-item” href=”/”>Home Page </a> <a class=”list-group-item” href=”#/academic”><i class=”fa fa-caret-right”></i>Academic Tutorials </a> <a class=”list-group-item” href=”#/bigdata”><i class=”fa fa-caret-right”></i>Big Data & Analytics </a> <a class=”list-group-item” href=”#/computerProg”><i class=”fa fa-caret-right”></i>Computer Programming </a> <a class=”list-group-item” href=”#/computerscience”><i class=”fa fa-caret-right”></i>Computer Science </a> <a class=”list-group-item” href=”#/databases”><i class=”fa fa-caret-right”></i>Databases </a> <a class=”list-group-item” href=”#/devops”><i class=”fa fa-caret-right”></i>DevOps </a> </div> </div> </div> </div> <div class=”sidebar sidebar-right”> <div class=”scrollable”> <h1 class=”scrollable-header app-name”>eBooks</h1> <div class=”scrollable-content”> <div class=”list-group” ui-toggle=”uiSidebarRight”> <a class=”list-group-item” href=”#/php”><i class=”fa fa-caret-right”></i>PHP </a> <a class=”list-group-item” href=”#/Javascript”><i class=”fa fa-caret-right”></i>Javascript </a> </div> </div> </div> </div> <div class=”app”> <div class=”navbar navbar-app navbar-absolute-top”> <div class=”navbar-brand navbar-brand-center” ui-yield-to=”title”> TutorialsPoint </div> <div class=”btn-group pull-left”> <div ui-toggle=”uiSidebarLeft” class=”btn sidebar-left-toggle”> <i class=”fa fa-th-large “></i> Tutorials </div> </div> <div class=”btn-group pull-right” ui-yield-to=”navbarAction”> <div ui-toggle=”uiSidebarRight” class=”btn sidebar-right-toggle”> <i class=”fal fa-search”></i> eBooks </div> </div> </div> <div class=”navbar navbar-app navbar-absolute-bottom”> <div class=”btn-group justified”> <a ui-turn-on=”aboutus_modal” class=”btn btn-navbar”><i class=”fal fa-globe”></i> About us</a> <a ui-turn-on=”contactus_overlay” class=”btn btn-navbar”><i class=”fal fa-map-marker-alt”></i> Contact us</a> </div> </div> <!– App body –> <div class=”app-body”> <div class=”app-content”> <ng-view></ng-view> </div> </div> </div><!– ~ .app –> <!– Modals and Overlays –> <div ui-yield-to=”modals”></div> </body> </html> /js/app.js /* eslint no-alert: 0 */ ”use strict”; // // Here is how to define your module // has dependent on mobile-angular-ui // var app=angular.module(”myFirstApp”, [ ”ngRoute”, ”mobile-angular-ui”, ”mobile-angular-ui.gestures” ]); app.config(function($routeProvider, $locationProvider) { $routeProvider .when(“/”, { templateUrl : “src/home/home.html” }); $locationProvider.html5Mode({enabled:true, requireBase:false}); }); app.directive(”dragItem”, [”$drag”, function($drag) { return { controller: function($scope, $element) { $drag.bind($element, { transform: $drag.TRANSLATE_BOTH, end: function(drag) { drag.reset(); } }, { sensitiveArea: $element.parent() } ); } }; }]); app.controller(”MainController”, function($rootScope, $scope, $routeParams) { $scope.testSwipe=function(direction) { alert(”You swiped ” + direction); }; }); src/home/home.html <div class=”scrollable”> <div class=”scrollable-content section” ui-swipe-left=”testSwipe(”left side”)” ui-swipe-right=”testSwipe(”right side”)”> <h2>Testing of Swipe gesture</h2> <div> Swipe left and right to activate the uiSwipeLeft and uiSwipeRight Directive. </div> </div> </div> Following is the display in the browser − The directive for swipe are added inside home.html. <div class=”scrollable-content section” ui-swipe-left=”testSwipe(”left side”)” ui-swipe-right=”testSwipe(”right side”)”> It calls a method testSwipe(), it is defined in app.js. $scope.testSwipe=function(direction) { alert(”You swiped ” + direction); }; Print Page Previous Next Advertisements ”;

Mobile Angular UI – Core Details

Mobile Angular UI – Core Details ”; Previous Next The Mobile Angular Core module manages all the core functionalities. You can make use of it inside the angular app using ‘mobile-angular-ui.core’ as a dependency module. In earlier chapters, we have used ‘mobile-angular-ui’ directly that has the core module too. But you can standalone make use of the ‘mobile-angular-ui.core’ module. You can do this when you need limited functionality, i.e., only the core functionality of Mobile Angular UI in your app. Following are the important sub modules that we will talk in Mobile Angular Core Module − activeLinks capture outerClick Print Page Previous Next Advertisements ”;

Mobile Angular UI – Project Setup

Mobile Angular UI – Project Setup ”; Previous Next This chapter will work on the project setup. We are going to make use of this setup to work with examples in the rest of the chapters. The project setup will be done using npm, as it is easy to install any packages required. Open your command prompt and create a directory called uiformobile/ and enter the directory using cd command. Now execute the following command − npm init The command npm init will initialize the proect − It will create package.json as shown below − { “name”: “uiformobile”, “version”: “1.0.0”, “description”: “”, “main”: “index.js”, “scripts”: { “test”: “echo “Error: no test specified” && exit 1″ }, “author”: “”, “license”: “ISC” } Now run following command to install mobile angular ui. npm install –save mobile-angular-ui To work with Mobile Angular UI, we need AngularJS. Let us install that using the following command − npm install –save-dev angular We also need the angular-route to work with routing. To install it the command is − npm install –save-dev angular-route We would need a server that will run our app in the browser. We will make use of express. The command to install express is − npm install –save-dev express Create a file server.js inside the root folder. This file will have the express command to start the server. Here are the details of server.js − const express=require(”express”) const app=express(); const port=3000; var path=require(“path”); app.use(“/node_modules”, express.static(“D:/uiformobile/node_modules”)); app.use(“/src”, express.static(“D:/uiformobile/src/”)); app.use(“/src/js”, express.static(“D:/uiformobile/src/js”)); app.all(“/*”, function (req, res, next) { res.sendFile(“index.html”, { root: “D:/uiformobile/” }); }); app.listen(port, () => console.log(”Starting your Mobile Angular App on port ${port}!”)) To start the server, use the following command − node server.js. The server will start at port 3000. You can make use of http://localhost:3000/ to see the UI in your browser. The final folder structure is as shown below − The folder node_modules/ has all the packages installed for mobile_angular_ui, angularjs, and angular-route. The src/ folder will have the HTML and js files required for the development of UI. The index.html is the start point that will be seen when you hit http://localhost:3000/. Now the required packages are installed. Let us now talk about the important css and js files we need. Though the framework is meant for Mobile Application, it can also be used for desktop apps. Following are the important css files that are mandatory to be included in your .html files. Sr.No File & Description 1 mobile-angular-ui-base.css This css file is meant for mobile devices and tablets. 2 mobile-angular-ui-desktop.css Responsive css file meant to be used on desktop and mobile devices. 3 mobile-angular-ui-hover.css This has css rules for hover. 4 angular.min.js AngularJS file that we need to start with the project. 5 mobile-angular-ui.min.js This is the mobile angular UI js file that we need to use in the dependency module in AngularJS module. This is the core module. 6 angular-route.min.js This is an AngularJS Route file used for Routing. All the above files are present inside node_modules/. We are done with the project setup, now we are going to make use of this project in the next chapter to develop our first app. Print Page Previous Next Advertisements ”;

Mobile Angular UI – Components

Mobile Angular UI – Components ”; Previous Next In this chapter, we are going to understand the important components in mobile angular UI. They are as follows − Navbars Sidebars Modals Overlays Navbars Navbars make use of the top and bottom portion of the device screen. We can use the top navbar to display the menu items or the header section. The bottom navbar can be used to display the footer section. A simple display of navbar on the screen is as follows − Navbar can be shown in two ways: fixed and overflow approach. Important CSS classes In Mobile Angular UI to show navbar you have to make use of css classes − navbar, .navbar-app. Classes for Top/Bottom Overflow approach For the top navbar the css class − .navbar-absolute-top. For the bottom navbar the css class − .navbar-absolute-bottom. Classes for Top/Bottom fixed approach For the top navbar the css class − .navbar-fixed-top. For the bottom navbar the css class − .navbar-fixed-bottom. Let us work on the Overflow Navbar on the UI. Following is the HTML code for the same − Navbar-Top <div class=”navbar navbar-app navbar-absolute-top”> <div class=”btn-group pull-left”> <div class=”btn”> <i class=”fa fa-th-large “></i> Library </div> </div> <div class=”navbar-brand navbar-brand-center” ui-yield-to=”title”> TutorialsPoint </div> <div class=”btn-group pull-right” ui-yield-to=”navbarAction”> <div class=”btn”> <i class=”fal fa-search”></i> eBooks </div> </div> </div> Navbar-Bottom <div class=”navbar navbar-app navbar-absolute-bottom”> <div class=”btn-group justified”> <a href=”https://www.tutorialspoint.com/about/index.htm” class=”btn btn-navbar”><i class=”fal fa-globe”></i> About us</a> <a href=”https://www.tutorialspoint.com/about/contact_us.htm” class=”btn btn-navbar”><i class=”fal fa-map-marker-alt”></i> Contact us</a> </div> </div> This is how the display looks like − Sidebars The sidebars occupy the left and right side of the screen. They are always hidden and activated when the item connected to the left side or right side is clicked. It is the best way to utilize the space on the screen. So far we have seen the working of navbars. Let us now make use of the navbar item on the left side and right side to open the sidebars. You can place sidebars on the left side or right side. Important CSS classes The css classes for left side sidebar − sidebar sidebar-left. The css classes for right side sidebar − sidebar sidebar-right. The div container for sidebar is as follows − <!– Sidebars –> <div class=”sidebar sidebar-left”><!– … –></div> <div class=”sidebar sidebar-right”><!– … –></div> Interaction with Sidebars To open and close the sidebars added on the left side and right side you need to add the following to the html tag that will open the sidebars. For example, to open left sidebar on click on a link you can add the following − Sidebar makes use of sharedstate uiSidebarLeft and uiSidebarRight to toggle the sidebar items. We are going to make use of the top navbar we added earlier. Add ui-toggle=”uiSidebarLeft” and ui-toggle=”uiSidebarRight” and also the class sidebar-toggle and sidebar-right-toggle. <div ui-toggle=”uiSidebarLeft” class=”btn sidebar-toggle”><i class=”fa fa-th-large “></i> Library</div> <div ui-toggle=”uiSidebarRight” class=”btn sidebar-right-toggle”><i class=”fal fa-search”></i> Search</div> Let us now add a div container for the left sidebar and right sidebar. Left Sidebar <div class=”sidebar sidebar-left”> <div class=”scrollable”> <h1 class=”scrollable-header app-name”>Tutorials</h1> <div class=”scrollable-content”> <div class=”list-group” ui-turn-off=”uiSidebarLeft”> <a class=”list-group-item” href=”/”>Home Page </a> <a class=”list-group-item” href=”#/academic”><i class=”fa fa-caret-right”></i>Academic Tutorials </a> <a class=”list-group-item” href=”#/bigdata”><i class=”fa fa-caret-right”></i>Big Data & Analytics </a> <a class=”list-group-item” href=”#/computerProg”><i class=”fa fa-caret-right”></i>Computer Programming </a> <a class=”list-group-item” href=”#/computerscience”><i class=”fa fa-caret-right”></i>Computer Science </a> <a class=”list-group-item” href=”#/databases”><i class=”fa fa-caret-right”></i>Databases </a> <a class=”list-group-item” href=”#/devops”><i class=”fa fa-caret-right”></i>DevOps </a> </div> </div> </div> </div> You can make use of ui-turn-off=”uiSidebarLeft” or ui-turn-off=”uiSidebarRight” in your sidebar template to close the sidebar when clicked anywhere inside the sidebar. The sidebar will be closed by default when clicked anywhere outside the sidebar template. In the left side bar when the user clicks on the links, the sidebar will be closed as we have added ui-turn-off=”uiSidebarLeft” to the left sidebar template. Right Sidebar <div class=”sidebar sidebar-right”> <div class=”scrollable”> <h1 class=”scrollable-header app-name”>eBooks</h1> <div class=”scrollable-content”> <div class=”list-group” ui-toggle=”uiSidebarRight”> <a class=”list-group-item” href=”#/php”><i class=”fa fa-caret-right”></i>PHP </a> <a class=”list-group-item” href=”#/Javascript”><i class=”fa fa-caret-right”></i>Javascript </a> </div> </div> </div> </div> The display of sidebar in the browser is as follows − Click on Tutorials to get left sidebar menu as shown below − Click on Ebooks to get right side menu as shown below − Modals and Overlays Modals and Overlays will show a pop-up type window on your screen. Overlays differ from modal only in how the container is displayed for it. You need to make use of ngIf/uiIf or ngHide/uiHide along with uiState to activate/dismiss the overlay or modal. The css for modal will be .modal, and for overlay, it will be .modal-overlay. To show modal and overlay, add the following div container inside your index.html. <div ui-yield-to=”modals”></div> Let us assign a modal to the navbar footer we have done earlier. Here ABOUT US will act as a modal and CONTACT US will act as an overlay. Add the following changes to the links of ABOUT US and CONTACT US − <div class=”navbar navbar-app navbar-absolute-bottom”> <div class=”btn-group justified”> <a ui-turn-on=”aboutus_modal” class=”btn btn-navbar”><i class=”fal fa-globe”></i> About us</a> <a ui-turn-on=”contactus_overlayl” class=”btn btn-navbar”><i class=”fal fa-map-marker-alt”></i> Contact us</a> </div> </div> If we click on this link, the modal and overlay will open. The content for modal and overlay is added inside src/home/home.html file. The main content for modal and overlay has to be wrapped inside the following div container − <div ui-content-for=”modals”> <div class=”modal”><!– … –></div> </div> Let us add content to the modal and overlay view. The name we have used on the links i.e., ui-turn-on=”aboutus_modal” and ui-turn-on=”contactus_overlay”, the same are used inside for the aboutus modal content

Mobile Angular UI – Overview

Mobile Angular UI – Overview ”; Previous Next Mobile Angular UI is an open-source framework for developing hybrid mobile apps. Mobile Angular UI makes use of Twitter Bootstrap and AngularJS that helps to create attractive HTML5 hybrid mobile and desktop apps. Features of Mobile Angular UI Mobile Angular UI has some cool components that are listed below − Navbars − Navbars makes use of the top and bottom portion of the device screen. We can use the top navbar to display the menu items or the header section. The bottom navbar can be used to display the footer section. Scrollable Areas − This feature makes the app more user friendly. Adding css classes .scrollable-header/.scrollable-footer, will add fixed header/footer to the scrollable area you want. You don’t have to take any trouble about the height and positioning, the css will take care of everything. Accordion − Accordions are mostly used when the content is supposed to be in section type of view and any, one section is visible at a time. You can hide and open the next section to view the contents in it. Dropdowns − To work with dropdowns adding the css .dropdown-menu to the container serves the purpose. Modals and Overlays − Modals and Overlays will show a pop-up type window on your screen. Overlays differ from modal only in how the container is displayed for it. Sections − Sections are containers that are displayed inside the body. You can modify the layout of your display in the device with classes available with sections. You can make use of the classes like .section-default, .section-primary, .section-success, .section-info, .section-warning or .section-danger to change the layout. Sidebars − The sidebars occupy the left and right side of the screen. They are always hidden and activated when the item connected to the left side or right side is clicked. It is the best way to utilize the space on the screen. Toggle Switch − Mobile Angular UI offers toggle switch elements using the ui-switch directive. The ui-switch directive makes a toggle when applied on to a boolean ngModel value. Tabs − Tabs are useful components available in angular mobile ui.Tabs are available in the same wrapper and show your contents in separate pane just like how the tabs are opened in the browser. Only one tab is displayed to the user at a time. Advantages of Mobile Angular UI The following are the advantages of Mobile Angular UI − Mobile Angular UI provides cool UI mobile components like navbar, sidebars, modals and overlays, switches, etc. Easy to create hybrid apps as it makes use of AngularJS and Twitter Bootstrap that is very easy to learn and get started. Also, it’s a free open source framework. It is possible to use ionic components along with Mobile Angular UI components. Disadvantages of Mobile Angular UI The following are the disadvantages of Mobile Angular UI − Being a JavaScript-only framework, applications written in AngularJS are not safe. Server-side authentication and authorization are must to keep an application secure. As the AngularJS directives are added to the HTML markup debugging becomes a little difficult when the error comes up. Print Page Previous Next Advertisements ”;

Mobile Angular UI – Sections

Mobile Angular UI – Sections ”; Previous Next Sections are containers that are displayed inside the body. Mobile Angular UI makes use of classes available for sections to change the layout structure. Here is the index.html − <!DOCTYPE html> <html> <head> <meta charset=”utf-8″ /> <title>Mobile Angular UI Demo</title> <meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″ /> <meta name=”apple-mobile-web-app-capable” content=”yes” /> <meta name=”viewport” content=”user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimal-ui” /> <meta name=”apple-mobile-web-app-status-bar-style” content=”yes” /> <link rel=”shortcut icon” href=”/assets/img/favicon.png” type=”image/x-icon” /> <link rel=”stylesheet” href=”node_modules/mobile-angular-ui/dist/css/mobile-angular-ui-hover.min.css” /> <link rel=”stylesheet” href=”node_modules/mobile-angular-ui/dist/css/mobile-angular-ui-base.min.css” /> <link rel=”stylesheet” href=”node_modules/mobile-angular-ui/dist/css/mobile-angular-ui-desktop.min.css” /> <script src=”node_modules/angular/angular.min.js”></script> <script src=”node_modules/angular-route/angular-route.min.js”></script> <script src=”node_modules/mobile-angular-ui/dist/js/mobile-angular-ui.min.js”></script> <script src=”node_modules/angular-route/angular-route.min.js”></script> <script src=”node_modules/mobile-angular-ui/dist/js/mobile-angular-ui.gestures.min.js”></script> <link rel=”stylesheet” href=”src/css/app.css” /> <script src=”src/js/app.js”></script> <style> a.active { color: blue; } </style> </head> <body ng-app=”myFirstApp” ng-controller=”MainController” class=”listening”> <!– Sidebars –> <div class=”sidebar sidebar-left “> <div class=”scrollable”> <h1 class=”scrollable-header app-name”>Tutorials</h1> <div class=”scrollable-content”> <div class=”list-group” ui-turn-off=”uiSidebarLeft”> <a class=”list-group-item” href=”/”>Home Page </a> <a class=”list-group-item” href=”#/academic”> <i class=”fa fa-caret-right”></i>Academic Tutorials </a> <a class=”list-group-item” href=”#/bigdata”> <i class=”fa fa-caret-right”></i>Big Data & Analytics </a> <a class=”list-group-item” href=”#/computerProg”> <i class=”fa fa-caret-right”></i>Computer Programming </a> <a class=”list-group-item” href=”#/computerscience”> <i class=”fa fa-caret-right”></i>Computer Science </a> <a class=”list-group-item” href=”#/databases”> <i class=”fa fa-caret-right”></i>Databases </a> <a class=”list-group-item” href=”#/devops”> <i class=”fa fa-caret-right”></i>DevOps </a> </div> </div> </div> </div> <div class=”sidebar sidebar-right”> <div class=”scrollable”> <h1 class=”scrollable-header app-name”>eBooks</h1> <div class=”scrollable-content”> <div class=”list-group” ui-toggle=”uiSidebarRight”> <a class=”list-group-item” href=”#/php”><i class= “fa fa-caret-right”></i>PHP </a> <a class=”list-group-item” href=”#/Javascript”><i class=”fa fa-caret-right”></i>Javascript </a> </div> </div> </div> </div> <div class=”app”> <div class=”navbar navbar-app navbar-absolute-top”> <div class=”navbar-brand navbar-brand-center” ui-yield-to=”title”> TutorialsPoint </div> <div class=”btn-group pull-left”> <div ui-toggle=”uiSidebarLeft” class=”btn sidebar-left-toggle”> <i class=”fa fa-th-large “></i> Tutorials </div> </div> <div class=”btn-group pull-right” ui-yield-to=”navbarAction”> <div ui-toggle=”uiSidebarRight” class=”btn sidebar-right-toggle”> <i class=”fal fa-search”></i> eBooks </div> </div> </div> <div class=”navbar navbar-app navbar-absolute-bottom”> <div class=”btn-group justified”> <a ui-turn-on=”aboutus_modal” class=”btn btn-navbar”><i class=”fal fa-globe”></i> About us</a> <a ui-turn-on=”contactus_overlay” class=”btn btn-navbar”><i class=”fal fa-map-marker-alt”></i> Contact us</a> </div> </div> <!– App body –> <div class=”app-body”> <div class=”app-content”> <ng-view></ng-view> </div> </div> </div><!– ~ .app –> <!– Modals and Overlays –> <div ui-yield-to=”modals”></div> </body> </html> app.js /* eslint no-alert: 0 */ ”use strict”; // // Here is how to define your module // has dependent on mobile-angular-ui // var app=angular.module(”myFirstApp”, [”ngRoute”, ”mobile-angular-ui”, ”mobile-angular-ui.gestures”, ]); app.config(function($routeProvider, $locationProvider) { $routeProvider.when(“/”, { templateUrl : “src/home/home.html” }); $routeProvider.when(“/academic”, {templateUrl : “src/academic/academic.html” }); $routeProvider.when(“/bigdata”, {templateUrl : “src/bigdata/bigdata.html” }); $locationProvider.html5Mode({enabled:true, requireBase:false}); }); app.directive(”touchtest”, [”$touch”, function($touch) { return { restrict: ”C”, link: function($scope, elem) { $scope.touch=null; $touch.bind(elem, { start: function(touch) { $scope.containerRect=elem[0].getBoundingClientRect(); $scope.touch=touch; $scope.$apply(); }, cancel: function(touch) { $scope.touch=touch; $scope.$apply(); }, move: function(touch) { $scope.touch=touch; $scope.$apply(); }, end: function(touch) { $scope.touch=touch; $scope.$apply(); } }); } }; }]); app.controller(”MainController”, function($rootScope, $scope, $routeParams) { $scope.msg=”Welcome to TutorialsPoint!”; }); home/home.html <div class=”scrollable “> <div class=”scrollable-content “> <div class=”list-group text-center”> <div class=”list-group text-center”> <div class=”list-group-item list-group-item-home”> <h1>{{msg}}</h1> </div> </div> <div class=”list-group-item list-group-item-home” style=”background-color: #ccc;”> <div> <h2 class=”home-heading”>List of Latest Courses</h2> </div> </div> <div class=”list-group-item list-group-item-home list-tuts”> <div> <h4 class=”home-heading”>Information Technology</h4> </div> </div> <div class=”list-group-item list-group-item-home list-tuts”> <div> <h4 class=”home-heading”>Academics</h4> </div> </div> <div class=”list-group-item list-group-item-home list-tuts”> <div> <h4 class=”home-heading”>Development</h4> </div> </div> <div class=”list-group-item list-group-item-home list-tuts”> <div> <h4 class=”home-heading”>Business</h4> </div> </div> <div class=”list-group-item list-group-item-home list-tuts”> <div> <h4 class=”home-heading”>Design</h4> </div> </div> <div class=”list-group-item list-group-item-home list-tuts”> <div> <h4 class=”home-heading”>Others</h4> </div> </div> </div> </div> </div> The container with class .app, holds the top and bottom navbar and the main contents that are displayed on the screen. The class .app does not have any padding or background. The class .section has the css to add padding and background. Here is a layout without a section. After adding class .section, you will see the padding added to the layout − <div class=”app section”></div> There are some more variations in sections for the layout. .section-wide : makes horizontal padding as 0 .section-condensed : makes vertical padding as 0 .section-break : this class will add margin-bottom as well shadow to show the break in sections on the screen. You can also play around with the additional classes like .section-default, .section-primary, .section-success, .section-info, .section-warning or .section-danger to change the layout. Print Page Previous Next Advertisements ”;