angularjs用于移动开发

来源:互联网 发布:mac os 系统更新 编辑:程序博客网 时间:2024/05/22 00:24

最近几个月,我一直在分享不同版本的“员工目录”示例应用程序,使用不同技术堆栈,不同的框架,和不同的后端(REST服务)实现。最新版本包括:

  • Employee Directory with Backbone.js, RequireJS, and Twitter Bootstrap
  • Employee Directory with Backbone.js, RequireJS, Topcoat and PhoneGap

对于人们要求的AngularJS版本,在这里。

你可以体验以下的应用程序。

点击这里,可以在一个浏览器中查看运行的这个完整程序。

这个版本,为移动端界面,使用了一个新的 Topcoat CSS框架。

源代码

这个示例的源代码在 GitHub:http://github.com/ccoenraets/angular-directory

数据服务

这个应用使用两种不同的数据服务

  • 内存数据服务(默认)中使用 memory-services.js 以提供没有服务依赖的出箱经验。
  • REST 数据服务使用 rest-services.js 以提供更加真实的实现。

程序运行在REST服务中:

  1. 在您的系统中安装 Node.js 以及 MongoDB
  2. 进入 angular-directory/server 目录,运行:
    1npm install
  3. 运行:
    1node server
  4. 在 app.js, 修改:
    1angular.module('myApp', [
    2    'ngRoute',
    3    'myApp.controllers',
    4    'myApp.memoryServices'
    5]).

    修改为:

    1angular.module('myApp', [
    2    'ngRoute',
    3    'myApp.controllers',
    4    'myApp.restServices'
    5]).
  5. 为了避免一些跨域问题,访问以下URL:
    view source
    print?
    1http://localhost:3000
0 0