我正在尝试ngOptions
与track by
这是我的模板
<select ng-model="asd" ng-options="user.id as user.name for user in users track by user.id | orderBy: 'name'">
Run Code Online (Sandbox Code Playgroud)
这是我的控制器
function AppCtrl($scope) {
$scope.users = [
{id : 25, name: 'Batista'},
{id : 26, name: 'Ultimate Warrior'},
{id : 27, name: 'Andre the giant'}
];
$scope.name = 'asdasd';
$scope.asd = 25;
}
Run Code Online (Sandbox Code Playgroud)
嗨伙计们,我只是想问为什么我的ajax请求确实得到一个FALSE字符串(它应该从控制器获取错误消息).
这是控制器的片段
function ajax_verify(){
$this->form_validation->set_rules('username', '', 'max_length[25]|min_length[4]|trim|required|xss_clean');
$this->form_validation->set_rules('email', '', 'valid_email|required|trim|xss_clean');
if($this->form_validation->run()==FALSE){
$errors = $this->form_validation->error_array();
echo json_encode($this->form_validation->error_array());
}else{
echo "Success!";
}
}
Run Code Online (Sandbox Code Playgroud)
我扩展了库以获取错误消息(它在php验证中完美运行)
class MY_Form_validation extends CI_Form_validation{
function __construct(){
parent::__construct();
}
function error_array(){
if(count($this->_error_array)===0){
return FALSE;
}else{
return $this->_error_array;
}
}
function get_tae(){
return "TAE!";
}
}
Run Code Online (Sandbox Code Playgroud)
并持续查看和jquery ajax代码(返回false而不是错误).
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<title>Title</title>
<body>
<?php //echo validation_errors('<div class="error">', '</div>');?>
<?php echo form_open('ajax/ajax_verify', array('id'=>'my_form'));?>
<?php echo form_label('Username'); ?>
<?php echo form_input('username', '', array('id' => 'username'));?> …
Run Code Online (Sandbox Code Playgroud) 我正在使用fullCalendar插件,并且试图弄清楚如何确定所单击的单元格是否全天。我已经检查过文档,但在那儿找不到。
这是我的代码片段:
$('.calender').fullCalendar({
allDaySlot: true,
dayClick: function(date, jsEvent, view) {
// click event trigged
// but how can I determine if its an all-day?
}
});
Run Code Online (Sandbox Code Playgroud)