Mobile first! Wijmo 5 + Ionic Framework: Hello World !, Wijmoionic

Source: Internet
Author: User

Mobile first! Wijmo 5 + Ionic Framework: Hello World !, Wijmoionic

In this tutorial, we use Wijmo 5 and Ionic Framework to implement a Mobile project: Hello World.

What is Ionic?

Ionic is an HTML5 framework that is free and open-source. It is used to help generate hybird mobile Apps (hybrid mobile Apps ).

Ionic contains three parts:

  • CSS style: Used to render Web pages so that pages are closer to Native apps ).
  • AngularJS: Ionic uses AngularJs extension commands as the core framework library, and AngularJs accelerates the development process.
  • Apache Cordova: Ionic uses Apache Cordova to compile it into a mobile App, and provides the ngCordova library-Cordova API library extended by AngularJs.

The Ionic framework is still in beta stage (by the end of this article, the latest version: v1.0.0-beta.12 "kryton-koala" · MIT Licensed ), the current version supports iOS6 + and Android 4.1 +, and supports Windows devices in a planned manner. There is no version support plan for older devices.

Required

This tutorial uses the following environment. Please prepare in advance.

  • Git
  • Node. js
  • Bower
  • Apache Cordova

In this tutorial, we use Chrome for development and debugging. At the same time, you can use other browsers for debugging on Android and IOS devices.

To configure the system environment, see the Cordova Platform Guide and follow the wizard.

Quick Start

Based on NodeJs installed in the above system environment, we first install Ionic CLI.

The following command line code for Windows, Linux, and Mac is used for installation:

Windows

npm install --g ionic

Linux and Mac

sudo npm install --g ionic

 

Run the following command to create a project:

ionic start ExpenseTracker blank && cd ExpenseTracker

The above command uses the empty Ionic template "blank" and creates an Ionic project named "ExpenseTracker". After the project is created successfully, we enter the newly created ExpenseTracker directory. Then we run the Ionic command to start the Web site.

ionic serve

This command starts the Web service and uses the default browser to start the page.

Any modifications made when the Web service is started, refresh the browser page without restarting the Web service, which is very convenient for debugging.

The following page is displayed:

After the file directory structure is configured, we can use Inonic and Wijmo 5. In the wwwdirectory, create an index.html file, edit it with the IDE (Visual Studio, Web Storm) You are used to, and add jQuery and Wijmo references:

<!DOCTYPE html>The AngularJs file is not directly referenced in the index.html file because Ionic (ionic. bundle. js file) it already contains AngularJs and its dependencies, such as UI-Router, so it does not need to be referenced directly. Use Wijmo 5

Next, add the Wijmo 5 control to the Index. HTML file. First, add the Wijmo module dependency to the www/js/app. js file --'Wj'.

The complete code of app. js is as follows:

angular.module('starter', ['ionic', 'wj']).run(function($ionicPlatform) {  $ionicPlatform.ready(function() {    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard    // for form inputs)    if(window.cordova && window.cordova.plugins.Keyboard) {      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);    }    if(window.StatusBar) {      StatusBar.styleDefault();    }  });})

In app. js, the ionic and wijmo modules have been introduced. You can directly use the custom AngularJs command of Wijmo 5 below.

In the index.html file<body>The AngularJS commands of three icons are introduced in the element:<ion-pane>,<ion-header-bar>, And<ion-content>。

  • <Ion-pane>: This command is a container used to fill the content.
  • <Ion-header-bar>: This command is used to add a header to the page.
  • <Ion-content>: This command creates a content area and replaces the default browser with the custom rolling view of Ionic.

In<Ion-content>,We add<Wj-input-number (Wijmo InputNumber control), the complete code is as follows:

<ion-pane>      <ion-header-bar class="bar-stable">        

Run the project. You can see that the Wijmo InputNumber control has been added to the page. The default value is 1, the maximum value is 5, the minimum value is-5, and the growth step is 1.

 

Summary

In this article, we created an Ionic project and added the Wijmo 5 InputNumber control to complete a Hello World!

Project compressed package




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.