是否有关于如何构建 ionic apps on visual studio 的教程?

有人用过 ionic templates in VS 吗?当我尝试打开此模板时,出现此错误:



如果我通过 VS 2013 Community 模板下载并安装(在新项目对话框中),我会在创建项目后收到此错误:



问题: 我怎样才能在这里获得 VS 无法找到的那些 .targets 文件?

最佳答案

这是因为此模板现在仅支持 Visual Studio 2015 RC,但您使用的是 VS2013 的 VS 12.0。

[ 更新 ]

注:以下内容日后可能会移至博客或某处分享给他人。

环境 :

工具:Visual Studio 2013 Update 4 + Apache Cordova CTP 3.1 工具

操作系统:Windows 8.1 专业版

主题 :如何在 Visual Studio 2013 中从 https://github.com/driftyco/ionic-starter-tabs 上的模板开始开发 ionic

步骤1:

在 Visual Studio 2013 中创建了一个新的空白 Cordova 应用程序。

文件->新建->项目->JavaScript->Apache Cordova 应用程序-> 空白应用程序(名为 TestIonicTemplate)。

第2步:

https://github.com/driftyco/ionic-starter-tabs 下载模板
打开网站 http://code.ionicframework.com/# 。我们稍后会使用它。

第 3 步:

假设模板文件夹是 ionic-starter-tabs-master,项目是 TestIonicTemplate。然后开始将东西合并到VS项目中。

  • 进入visual studio,在文件夹下添加一个名为templates的新文件夹
    根项目文件夹。
  • 执行以下复制过去:Move all .js files from
    \ionic-starter-tabs-master\js\到 TestIonicTemplate\scripts 全部移动
    html 文件从\ionic-starter-tabs-master\templates 到
    TestIonicTemplate\templates
  • 回到VS->右键点击上面提到的文件夹->
    添加->现有项目。添加这些文件后,我们有以下内容
    结构体。


  • 第四步:

    根据我们下载的模板中的index.html,对VS项目的index.html做如下修改。
  • 添加对 ionic.css 和 ionic.bundle.js 的引用我们可以选择使用
    本地副本或 ionic CDN,您可以从
    http://code.ionicframework.com/# 我之前提到过。我在这里使用 CDN。
  • 删除对 index.js 的引用并添加对我们所有 .js 的引用
    复制的。
  • 从\ionic-starter-tabs-master\index.html 复制元行
  • 在正文中添加 'ng-app="starter"' 并删除默认的 html
    体内的元素。
  • 从\ionic-starter-tabs-master\index.html 复制正文内容现在
    我们有以下 index.html 代码:


  • <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
        <title>TestIonicTemplate</title>
    
        <!-- TestIonicTemplate references -->
        <link href="http://code.ionicframework.com/1.0.0/css/ionic.css" rel="stylesheet">
        <link href="css/index.css" rel="stylesheet" />
        <!-- ionic/angularjs js -->
        <script src="http://code.ionicframework.com/1.0.0/js/ionic.bundle.js"></script>
    </head>
    <body ng-app="starter">
        <!--
          The nav bar that will be updated as we navigate between views.
        -->
        <ion-nav-bar class="bar-stable">
            <ion-nav-back-button>
            </ion-nav-back-button>
        </ion-nav-bar>
        <!--
          The views will be rendered in the <ion-nav-view> directive below
          Templates are in the /templates folder (but you could also
          have templates inline in this html file if you'd like).
        -->
        <ion-nav-view></ion-nav-view>
    
        <!-- Cordova reference, this is added to your app when it's built. -->
        <script src="cordova.js"></script>
        <script src="scripts/platformOverrides.js"></script>
    
        <script src="scripts/app.js"></script>
        <script src="scripts/controllers.js"></script>
        <script src="scripts/services.js"></script>
    </body>
    </html>


    这是我在涟漪中看到的结果:

    关于visual-studio - 如何使用 Visual Studio 2013 社区创建 ionic 应用程序?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30925967/

    10-10 21:44
    查看更多