Native mobile Apps with NativeScript and Web Apps (Mobile First) with Ionic styles and components sharing the same code with Angular!
This template uses the default navigation of Angular, the navigation of Ionic 3 is not recommended to develop websites, therefore it is not recommended to use Ionic components that require Ionic navigation. However, in this template you can find an example of how to use components such as the side menu without depending on the navigation.
Using this template you can create a Web App (Mobile First) using Ionic 3 components and a Mobile Native App using NativeScript with the same code, yay!
For more details you can check the excellent NativeScript team article about Code Sharing Between Web and Mobile with Angular and NativeScript: https://www.nativescript.org/blog/code-sharing-between-web-and-mobile-with-angular-and-nativescript
Check the excellent video of Sebastian Witalec about Sharing Code Between Web and Native Apps
npm install (It's required to create the symlinks at the first time before to execute the app)
ng serve
cd nativescript
npm install
npm run livesync (Required to detect changes and reload the app from the simulator/device)
npm run ios (using other terminal)
View available commands here: Seed commands
Command | Action |
---|---|
npm install -g @angular/cli |
Install the Angular-cli. Remember see the documentation here |
ng g module [name] |
Generate a new Module. Recommended to create sections of your app that will load components with Lazy Loading. |
ng g component [name] |
Generate a new Component in the current directory. Remember add the moduleId property moduleId: module.id in every component |
ng g service [name] |
Generate a new Service. The app/providers/ path is recommended for shared services among several components. |
NativeScript requires the unicode of the icon, you can find the unicode with the name of the icon from the content of the src/fonts/ionicons.svg
file and later you can use it from a <Label>
or <Button>
, example:
// name: ion-ios-contact, unicode: 
<Button class="ion-icon" fontSize="25" text=""></Button>
Target Phone and Tablet Templates individually. The following extensions are supported:
Extension | Platform |
---|---|
.{html/scss} |
Web platform. Used from mobile when there is no .tns extension |
.tns.{html/scss} |
Only for mobile |
.tns.ios.{html/scss} |
Only for iOS |
.tns.android.{html/scss} |
Only for Android |
.tns.ios.phone.{html/scss} |
Only for iOS Phone |
.tns.android.phone.{html/scss} |
Only for Android Phone |
Syntax | Meaning | Expected Result |
---|---|---|
{{ title }} {{ getTitle() }} |
Render a value dynamically, this expression will be evaluated at run time. | |
[src]="imageUrl" |
Property Binding: Bind a property of a DOM element to a field of the component. | |
[attr.colspan]="colSpan" |
Attribute Binding | |
[class.selected]="user.selected" |
Class Binding: Add a class dynamically. | |
[style.color]="isActive? 'green': 'red'" |
Style Binding | |
(tap)="onSave($event)" |
Event Binding | |
(keyup.enter)="onEnter()" |
Event Filtering | |
#email (keyup.enter)="onEnter(email.value) |
Template variables | |
[(ngModel)]="user.email" |
Two-way Binding. Import FormsModule is required. | |
{{ price | currency:'AUD' }} |
Pipes: Format data. | |
@Input('input-property') myData; <example [input-property]="data"> |
Input Properties: Input data for the component. | |
@Output('output-property') change= new EventEmitter(); this.change.emit({msg: 'Hi!'}); <example (output-property)="onChange($event)"> |
Output Properties: Raise events from the component. | onChange({msg}) { console.log(msg) } |
Sean Perkins | Juan Nicholls |
I believe in Unicorns
Made with
真是一觉醒来,就又有新版本发布啊。 这一次的总结主要针对ionic3,当然也适用于ionic2. 不一定面面俱到,但是希望看到这篇总结开发者能够少走一些弯路。 First of all,当然是安装最新版的ionic了。 npm install -g ionic 可以用 ionic info 查看一系列依赖工具的版本。 Fine,现在开始创建ionic项目了。一切看起来的风平浪静的样子。 还是那句用
ionic UI(2)ionic2 framework - TypeScript - tutorial 1 Basic ENV > node --version v4.4.0 > npm install -g cordova > npm install -g ionic >npm install -g ios-sim > npm install -g ios-deploy > cordova --
一、Ionic2提供了一个简单的启动模板来快速支撑一个app,我们的app叫做githubIonic。 在你的终端: $ ionic start githubIonic tutorial --v2 --ts 上面的命令会创建一个ionic项目基于教程模板,然后下载必要的npm包,我们将会使用TypeScript,这就是为什么我们要使用--ts。 www/index.html一般是app的入口程序。
大多数应用程序基本都需要保存一些在应用重新加载时需要的数据。我们经常使用用户设备上的本地存储来实现。当使用Ionic/Angular的时候,我们可以简单的使用Ionic内置的Storage API,并不需要知道背后的原理——Ionic会自动地选择最合适的存储方式。 再说一次,在Vue里我们没有现成的东西可以用,是安装一个库还是自己搭建解决方案全决定于我们自己。 在这篇教程,我们将扩展上篇教程里的R
Angular Ionic app built with Capacitor + NativeScript This example app demonstrates the following: Angular Ionic app built with Capacitor Usage of @nativescript/capacitor to help solve real world issu
我是移动开发的新手,我看到ionic framework有很大的社区,但是 我知道ionic使用webview,而nativescript生成本地组件 我现在的问题是什么nativescript可以做离子不能做? 换句话说,nativescript中有哪些在爱奥尼亚没有的强大之处 提前谢谢。
我在移动领域已经有一段时间了,我们已经有了原生的Android和iOS应用程序。现在我们公司正计划加强我们的移动网站,我们的团队已经选择Angular 2 TypeScript Ionic 2。我们非常困难地完成了我们在爱奥尼亚的注册表格开发。现在我了解了NativeScript,它可以在不使用webview的情况下开发混合应用程序,而且由于它使用了本机UI组件,人们说它的外观 我有点困惑选择一个
更改历史 * 2017-12-31 胡小根 初始化文档 1 历史、现状和发展 1.1 历史 1.2 现状 1.3 发展 难点:预测发展方向。 2 安装和使用 2.1 安装 2.2 使用 2.3 示例 2.4 最佳实践 难点:最佳实践,超出于示例,应该归纳总结出积累的技巧。 3 同类技术对比 难点:归纳比对项 参考资料 xxx书籍 xxx博客 xxx类库说明
Ionic Framework 是一个移动 UI 工具包,用于构建高质量,跨平台的本机和Web应用程序体验。只需一个代码库,就可以更快地移动代码,并可以在JavaScript和Web上随处运行。
An advanced Ionic v1.x template Introduction You need to obfuscate your code and reduce the size of your mobile applications. With this project you can work with Gulp in the best way, allowing improve