ionic-framework - Ionic ionViewDidEnter 从 Ionic Creator 导出
问题描述
我是一个离子新手,我似乎无法弄清楚这一点。我在 Ionic Creator 中创建了一个项目,然后导出了 Zip。现在我有了controller.js
、services.js
文件等,但它们看起来不像文档中的示例源:https ://ionicframework.com/docs/components/#action-sheets
当我尝试查找示例时,我看到了诸如https://github.com/ionic-team/ionic-preview-app/tree/master/src/pages/action-sheets/basic之类的内容,但代码符合其中的内容文档。
例如,出口有这样的事情controllers.js
:
angular.module('app.controllers', [])
.controller('page1Ctrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($scope, $stateParams) {
}])
虽然示例代码像类一样构建:
import { ActionSheetController } from 'ionic-angular';
export class MyPage {
constructor(public actionSheetCtrl: ActionSheetController) { }
所以问题是:
我将如何ionViewDidEnter
在 Ionic Creator 导出的结构中使用?
解决方案
我明白你的问题。发生的事情是您在 Ionic 版本 1.x (1.3.2) 的 Ionic Creator 中创建了一个项目。Ionic 1 基于 Angular 1.x,Ionic 2 基于 Angular >= 2.x。使用 Ionic 1,您将看到 controller.js、services.js 和类似的文件。使用 Ionic 2/3,您将看到类、组件和类似的东西。
在开始使用 Ionic creator 创建设计之前,您需要选择 Ionic 版本。
推荐阅读
- python - 为什么 pop() 函数会更改字典的列表值,但 capitalize() 不能更改字符串值的大小写?
- python - numpy 函数 np.linspace 抛出值错误
- react-native - React-native-firebase 电话身份验证
- wagtail - 如何在可订购片段中获取类别值
- reporting-services - SSRS 报表生成器日期格式 dd.mm 转换为另一种格式
- java - CRM 经理 - 下拉列表保存选择的选项
- ssl - 为 SNI rust Web 服务器实现多个 TLS 证书和私钥的正确方法是什么?
- c# - EntityType ' ' 没有定义键。定义此 EntityType 的键。- C# Web API 实体框架
- html - 是否可以在类似于 SVG 开始和结束位置的 CSS 背景中设置渐变开始和结束位置?
- appium-android - java.lang.NoSuchMethodError: io.appium.java_client.AppiumDriver.setElementConverter(Lorg/openqa/selenium/remote/internal/JsonToWebElementConverter;)V