首页 > 解决方案 > Ionic ionViewDidEnter 从 Ionic Creator 导出

问题描述

我是一个离子新手,我似乎无法弄清楚这一点。我在 Ionic Creator 中创建了一个项目,然后导出了 Zip。现在我有了controller.jsservices.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-framework

解决方案


我明白你的问题。发生的事情是您在 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 版本。

在此处输入图像描述


推荐阅读