我在这一点上有点失落,但在我的搜索中找不到任何有用的东西,所以我希望有人可以帮助我.
我有一个RadioButtonList,我正在添加一个动态创建的ListItems列表,我在其中设置每个项目的文本和值.在RadioButtonList的DataBind上,ListItem的值被Text替换,这对我来说似乎没有意义.
当我在Firebug中看到标签和输入上的值是相同的时,我可以在客户端看到,并且值无处可见.
有没有其他人有这样的经历,或者有谁知道我可能会出错?
var rbList = new List<ListItem>();
var radioButtonList = new RadioButtonList();
foreach(var object in objects) {
var li = new ListItem {Text = object.Name, Value = object.Guid};
rbList.Add(li);
}
radioButtonList.DataSource = rbList;
radioButtonList.DataBind();
Run Code Online (Sandbox Code Playgroud) 我有一个使用Restangular的AngularJS App在Rails 4 API之上进行持久化.我遇到的问题是我的更新无法正常工作.
我的代码在routeProvider:
when('/course/edit/:courseId', {
controller: 'CourseEdit',
templateUrl: '/assets/templates/course/form.html',
resolve: {
course: function(Restangular, $route) {
return Restangular.one('courses', $route.current.params.courseId).get();
}
}
})
Run Code Online (Sandbox Code Playgroud)
我的控制器功能:
function CourseEdit($scope, $location, course) {
$scope.course = course;
$scope.save = function() {
$scope.course.put().then(function() {
$location.path('/course/view/' + $scope.course.id);
});
};
}
Run Code Online (Sandbox Code Playgroud)
PUT的请求正在http://mysite.com/courses而不是http://mysite.com/courses/id
就像我预期的那样,我似乎无法弄明白为什么.
rails抛出的错误是'No route matches [PUT] "/courses".
任何帮助将不胜感激.