创建Ionic项目始终从Internet下载文件 [英] Creating Ionic project always download files from internet

查看:43
本文介绍了创建Ionic项目始终从Internet下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是开发Ionic项目的新手.我已经准备好了可用的示例模板项目,对此我很满意.设法部署并能够运行其示例.

I'm newbie in developing Ionic project. I'm all set with the sample template projects available and i'm good with that. Managed to deploy and able to run their examples.

当我尝试在Windows中使用CMD创建一个新的空白项目 [离子启动LoginDemo空白] 时,它开始从互联网下载离子应用基础文件.

When I try to create a new blank project [ ionic start LoginDemo blank ], using CMD in windows, it started to download the ionic app base files from internet.

当我尝试为android创建平台时 [离子平台添加android] ,它将开始从互联网下载运行android版本所需的所有资源.

when i tried to create a platform for android [ ionic platform add android ] , it starts to download all the resources required to run the android version from internet.

我的问题是,每当我们在ionic中创建一个新项目时,所有必需的文件都会从Internet下载.有什么方法可以设置标准的开发环境,即一次下载文件并在创建新项目时使用它,而不是每次都从Internet下载,否则这是唯一的方法[em> [每次在创建项目时从Internet下载文件] .

So my question is, whenever we create a new project in ionic, all the required files are downloaded from the internet. Is there any way to setup a standard dev enviroment by downloading the files once and using it when creating new project instead of downloading each time from the internet or this is the only way [download files each time from the internet on creating project].

对此有任何澄清,我们深表感谢.!!谢谢您的帮助.

any clarification regarding this is much appreciated. !! Thank you for all your help.

如果我不清楚,请告诉我.

If i'm not clear kindly let me know.

推荐答案

只要您具有正确配置的CLI即可正常运行,就可以.但是,我建议不要这样做.下载所有文件时,它将获得每个文件的最新,稳定版本.这有助于消除此文件的某些修补程序中修复的潜在错误.

You can, as long as you have the configurations correct for the CLI to run properly. I however would advise against this. When it downloads all of the files, it gets the latest, stable release of each of the files. This helps squash potential bugs that are fixed in some of the patches of this file.

作为可能的问题解决方案,请编写足够灵活以在大多数环境中工作的服务/控制器/指令.如果对模板服务和帮助程序方法进行了正确的编码,它们的效率可能会一样高.

As a potential solution to your problem, write services/controllers/directives that are flexible enough to work in most environments. Creating template services and helper methods can be just as efficient if they are coded correctly.

例如,对于我的项目,我希望有一种向用户展示漂亮对话框的方法.这是一个非常通用的功能,因此我编写了一项为我完成的服务.我在所有应用程序中都使用了它,这提高了我的效率,因为我不必一遍又一遍地重写相同的代码.只需将文件复制到我的目录并引用它即可.

For example, for my projects I want to have a way to present a nice dialog box to the user. This is a pretty universal feature, so I wrote a service that did it for me. I use this in all my apps and it increases my efficiency because I don't have to rewrite the same code over and over. Its just a matter of copying the file into my directory and referencing it.

这是我的例子:

var module = angular.module('PopupModule', []);

module.service('PopupService', ['$ionicPopup', function ($ionicPopup) {
    var factory = {};

factory.ConfirmDialog = function (title, contents, actionName) {
    var data = {};

    return $ionicPopup.prompt({
        title: title,
        inputType: 'input',
        inputPlaceholder: contents
    });
}

factory.MessageDialog = function (message) {
    var alertPopup = $ionicPopup.alert({
        title: 'Message',
        template: message
    });
};

factory.InitializeModal = function ($ionicModal, $scope, templateUrl) {
    $ionicModal.fromTemplateUrl(templateUrl, {
        scope: $scope,
        animation: 'slide-in-up',
    }).then(function (modal) {
        $scope.modal = modal;
    });

    $scope.openModal = function () {
        $scope.modal.show();
    };

    $scope.closeModal = function () {
        $scope.modal.hide();
    };

    //Cleanup the modal when we're done with it!
    $scope.$on('$destroy', function () {
        $scope.modal.remove();
    });

    // Execute action on hide modal
    $scope.$on('modal.hidden', function () {
        // Execute action
    });

    // Execute action on remove modal
    $scope.$on('modal.removed', function () {
        // Execute action
    });
};

return factory;
}]);

这篇关于创建Ionic项目始终从Internet下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆