在 $routeProvider 上的交易模板后侧边栏无法工作!,在交易模板后我点击并没有打开菜单。
没有错误只返回一个带有我的 Controller 名称的警告。
HTML
<!-- Sidebars --> <div ng-include="'menu.html'" ui-track-as-search-param='false' class="sidebar sidebar-left"></div> <div class="sidebar sidebar-right"><!-- ... --></div> <div class="app" ng-swipe-right='Ui.turnOn("uiSidebarLeft")' ng-swipe-left='Ui.turnOff("uiSidebarLeft")'> <div class="navbar navbar-app navbar-absolute-top"> <div class="btn-group pull-left"> <div ui-toggle="uiSidebarLeft" class="btn "> <i class="fa fa-bars"></i> Menu </div> </div> <!-- <div class="navbar-brand navbar-brand-center" yield-to="title"> <span>Login</span> </div>--> <!-- Top Navbar --> </div> <div class="navbar navbar-app navbar-absolute-bottom"><!-- Bottom Navbar --></div> <!-- App body --> <div class='app-body'> <ng-view class="app-content"></ng-view> </div> </div><!-- ~ .app --> <!-- Modals and Overlays --> <div ui-yield-to="modals"></div> <script src="lib/scripts/angular.min.js"></script> <script src="lib/scripts/angular-route.min.js"></script> <script src="lib/scripts/angular-touch.min.js"></script> <script src="lib/scripts/angular-resource.min.js"></script> <script src="lib/scripts/mobile-angular-ui.min.js"></script> <script src="lib/scripts/jquery-2.1.4.min.js"></script> <script src="cordova.js"></script> <script src="scripts/platformOverrides.js"></script> <script src="scripts/index.js"></script> <script type="text/javascript"> var app = angular.module('appindex', [ "ngRoute", "ngTouch", "mobileangular-ui", "mobile-angular-ui.core",
"mobile-angular-ui.components" ]);
app.config(function ($routeProvider, $locationProvider) { $routeProvider.when('/unid', { templateUrl: "unid.html", controller: "unidController" // controller: "unidController" }); }); app.controller("indexController", function ($scope, $rootScope) { }); app.controller('unidController', function ($scope) { console.log("unidController") $scope.message = 'This is Show orders screen'; }); </script> </body> </html>
其他 HTML
<h2>Add New Order</h2> {{ message }}
最佳答案
解决方案:需要输入“reloadOnSearch: false”。这样做是正确的(最佳实践)??
谢谢
$routeProvider.when('/unid', { templateUrl: "unid.html", controller: "unidController", reloadOnSearch: false });
关于javascript - 交易模板 $routeProvider 之后侧边栏不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31342946/