有!我正在尝试使用partials,但是没有工作:
我的html文件已经创建并且到位,我无法理解为什么它不起作用!
我正在使用angular 1.6.4和ui-router 1.0.0-rc.1
任何人都可以帮助我?
myApp.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/home');
$stateProvider
.state("home", {
url: "/home",
templateUrl: "home.html",
controller: "HomeController",
});
$stateProvider
.state("about", {
url: "/about",
templateUrl: "about.html",
controller: "AboutController",
});
$stateProvider
.state("contact", {
url: "/contact",
templateUrl: "contact.html",
controller: "ContactController",
});
});
myApp.controller('HomeController', function($scope, $location) {
$scope.message = 'Home Controller!';
});
myApp.controller('AboutController', function($scope) {
$scope.message = 'About Controller.';
});
myApp.controller('ContactController', function($scope) {
$scope.message = 'Contact Controller';
});
如果我改为这个(下面)它可以正常工作:
var myApp = angular.module('helloworld', ['ui.router']);
myApp.config(function($stateProvider) {
var helloState = {
name: 'hello',
url: '/hello',
template: '<h3>hello world!</h3>'
}
var aboutState = {
name: 'about',
url: '/about',
template: '<h3>Its the UI-Router hello world app!</h3>'
}
$stateProvider.state(helloState);
$stateProvider.state(aboutState);
});
答案 0 :(得分:0)
对于初学者,请检查此段代码以获取room->challenges[i].visitor->room_name = malloc(sizeof(char*)*1);
*room->challenges[i].visitor->room_name = malloc(strlen(room_to_enter)+1);
...
$stateProvider
您的州之间不应该有app.config(function($stateProvider) {
$stateProvider
.state('home', {
url: '/home',
templateUrl: 'views/home.html'
}) // no semicolon here
.state('projects', {
url: '/projects',
templateUrl: 'views/projects.html'
}) // no semicolon here
// etc
});
。
此外,您应该将它们放在一起,而不是拆分;
此外,您应该删除$stateProvider
元素中每个控制器声明末尾的额外,
。