我正在尝试用RatchetJS (移动框架,而不是websocket服务器)构建一个应用程序。( goratchet.com!)和AngularJS (v1.5.8)。我的问题涉及项目组织、路由和页面加载。
如果我希望棘轮转换能很好地处理角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不会捕捉路由,控制器永远不会被调用.
如果我想使用棘轮过渡。我应该如何处理架构/路由?
发布于 2016-09-03 08:09:36
棘轮不是指过渡或你所指的东西。
它是作为PHP的一个WebSocket,您遇到的问题是客户端分页,所以尝试添加更多关于角度安装的信息。
https://stackoverflow.com/questions/39289851
复制相似问题