0
我正在尝试使用RatchetJS(移动框架,而不是websocket服务器,即goratchet.com !!)和AngularJS(v1.5.8)构建应用程序。我的问题涉及项目组织,路由和页面加载。与Ratchet.js集成AngularJS
如果我想要棘轮过渡与角度js路由和控制器很好地发挥,应该如何处理路由?这是我到目前为止。
的index.html
<!DOCTYPE html>
<html lang="en" ng-app="Application">
<head>
<meta charset="utf-8">
<title>MyApplication</title>
<base href="/">
<!-- Sets initial viewport load and disables zooming -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<!-- Makes your prototype chrome-less once bookmarked to your phone's home screen -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- Include the compiled Ratchet CSS -->
<link href="css/ratchet.css" rel="stylesheet">
<!-- <link href="css/ratchet-theme-ios.css" rel="stylesheet"> -->
<!-- <link href="css/ratchet-theme-android.css" rel="stylesheet"> -->
<!-- Include the compiled Ratchet JS -->
<script src="js/ratchet.min.js"></script>
<script src="js/angular.min.js"></script>
<script src="js/angular-route.min.js"></script>
<script src="app/app.js"></script>
</head>
<body>
<div class="view" ng-view></div>
</body>
</html>
角JS应用文件。
'use strict';
(function() {
var Application = angular.module('Application', ['ngRoute']);
Application.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
controller: 'DefaultController',
templateUrl: 'pages/home.html',
})
.when('/pages/chat.html', {
controller: 'ChatController',
templateUrl: '/pages/chat.html',
})
.otherwise({ redirectUrl: '/' })
;
$locationProvider.html5Mode(true);
}]);
Application.controller('DefaultController', ['$scope', '$route', function($scope, $route) {
$scope.title = "Grettings";
}]);
Application.controller('ChatController', ['$scope', function($scope) {
$scope.title = "Chat view";
}]);
})();
也有/pages/...
文件夹(home.html
和chat.html
)两个文件。在Home.html中包含一个链接看起来像:
<a data-ignore="push" href="/pages/chat.html">Go to chat</a>
如果我使用data-ignore="push"
页面被加载,而是通过角(所以没有棘轮转换没有它,当然,页面得到由棘轮加载,但AngularJS没有赶上路线和控制器从来不叫......
提供我想使用的转换棘轮。我应该如何处理我的建筑/路由?
http://goratchet.com/更是一个CSS js/css UI/UX框架...与websockets无关..或者?它确实提供了转换。 –