我正在使用flask + Angular + MongoDb應用程序。我正在使用狀態提供程序。狀態從應用程序加載完美。但是當我刷新頁面時,它正在拋出404錯誤。Python燒瓶角度應用程序狀態不刷新
- App.py:(燒瓶)
application = Flask(__name__) @application.route('/') def showMachineList(): print ("Inside the show machine list function") return application.make_response(open('templates/index.html').read())
- App.js(角)
- 國家
angular.module('testapp', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.router', 'ui.bootstrap','ngMaterial','ngCookies' ]) .config(function($urlRouterProvider, $locationProvider,$interpolateProvider) { $urlRouterProvider.otherwise('/'); //$interpolateProvider.startSymbol('//').endSymbol('//'); $locationProvider.html5Mode(true).hashPrefix('!'); });
angular.module('testapp') .config(function ($stateProvider) { console.log("inside create outage request") $stateProvider .state('cor', { url: '/cor', template: '<cor></cor>' //templateUrl: '/static/client/app/acn/acn.html' }); });
我已經加入index.html中的<base href="/">
爲好。 當我刷新頁面"http://localhost:5000/cor"
其投擲404. 你能讓我知道我失蹤了嗎?
但我已經定義了狀態,我認爲它也應該從Angular狀態加載。 –
您的HTML模板中可能有一個錯誤。 –