Modal with controller in Laravel - html

Hey friends I am creating a simple modal to show me the data of a provider and honestly is costing me quite a lot; Can someone give me a hand?
modal:
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
aria-labelledby="myModal">
<div class="modal-dialog"
role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModal">Detalle del Proveedor: </h4>
</div>
<div class="modal-body">
<div class="table-responsive">
<table class="table table-stripped table-bordered table-hover" id="table-detalle-proveedores">
<thead>
<tr>
<th>Nombre</th>
<th>Apellido</th>
<th>Telefono</th>
<th>Email</th>
<th>Dirección</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</div>
</div>
</div>
</div>
botton of modal
<a href="" class="btn btn-primary btn-detalle-proveedores" data-id="{{ $proveedores->id }}"
data-path="{{ route('admin.proveedores.item') }}" data-toggle="modal"
data-target="#myModal"
data-token="{{ csrf_token() }}">
<i class="fa fa-external-link"></i>
</a>
Route
Route::post('admin/proveedores/item', [
'as' => 'admin.proveedores.item',
'uses' => 'ProveedoresController#Item']);
function of controller
public function item(Request $request)
{
$items = Proveedores::select($request->id);
return json_encode($items);
}
I was testing that one and others but the maximum that I get it to show me in the console an empty object

Firstly, in your javascript you're passing the id as proveedores_id but in your controller you're trying to access it with $request->id.
It might be an idea to have a look at https://laracasts.com/series/laravel-from-scratch-2017/episodes/8
Secondly, with using just select you're just going to be returning a json encoded version of Builder.
To get your request to actually return an instance of Proveedores you would do something like:
public function item(Request $request)
{
$item = Proveedores::findOrFail($request->id);
return compact('item');
}
This also means you can remove the for loop inside your success method and simply access the data with response.item.* e.g.
function (response) {
console.log(response)
table.html('')
var fila = "<tr>" +
"<td>" + response.item.name + "</td>" +
"<td>" + response.item.last_name + "</td>" +
"<td>" + response.item.tel + "</td>" +
"<td>" + response.item.address + "</td>" +
"</tr>";
table.append(fila);
}
Hope this helps!

Related

datatable is not working properly with my ajax code

I had a Crud, in which I obtained the data of each record to be able to edit them, through a button("Asignar") with an event. In order to add a search bar I wanted to implement the DataTable plugin, but this, when importing my button, causes a conflict with the code; I would like to know what I must modify so that the button is operative with the DataTatable plugin.
DataTable Controller:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Siniestro;
class DataTableController extends Controller
{
public function paraderivar(Request $request)
{
$siniestros = Siniestro::select('id', 'siniestro','fechaip', 'modalidad','direccion','localidad', 'inspector')->get();
return datatables()->of($siniestros)
->addColumn('edit', '<button class="btn btn-info btn-sm" onclick="editData(value.id)"> Asignar </button>')
->rawColumns(['edit'])
->toJson();
}
}
blade.view
#extends('layouts.app')
#section('content')
<section class="section">
<div class="section-header">
<h3 class="page__heading">Derivar IP</h3>
</div>
<div class="section-body">
<div class="row">
<div class="col-sm-9">
<div class="card">
<div class="card-header">
<h4>Siniestros para derivar</h4>
</div>
<div class="card-body">
<table class="table table-sm m-1 p-1 table-bordered table-hover table-striped tablita" style="width:100%">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Siniestro</th>
<th scope="col">Fecha IP</th>
<th scope="col">Modalidad</th>
<th scope="col">Dirección</th>
<th scope="col">Localidad</th>
<th scope="col">Inspector</th>
<th scope="col">Acciones</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-sm-3" style="position:fixed; bottom:250px; right:0px">
<div class="card">
<div class="card-header">
<span id="addT">Asignar IP</span>
<span id="updateT">Asignar IP</span>
</div>
<div class="card-body">
<div class="col-xs-4 col-sm-4 col-md-4">
<div class="form-group">
<label for="siniestro">Siniestro</label>
<input type="text" name="siniestro" id="siniestro" class="form-control">
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4">
<label for="inspector">inspector</label>
<select class="form-select col-xs-12 col-sm-12 col-md-12" aria-label="Default select example" id="inspector"´for="inspector" name="inspector"">
#foreach ($users as $user)
<option value="{{ $user->id }}">{{ $user->name }}</option>
#endforeach
</select>
</div>
<div class="col-xs-4 col-sm-4 col-md-4">
<div class="form-group">
<label for="patente">Patente</label>
<input type="text" name="patente" id="patente" class="form-control">
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4">
<div class="form-group">
<label for="fechaip">Fecha IP</label>
<input type="date" name="fechaip" id="fechaip" class="form-control">
</div>
</div>
<input type="hidden" id="id">
<!-- <button type="button" href="#" data-target="#ModalEnviar" class="btn btn-primary m-2" data-toggle="modal">Enviar IP</button> -->
<button type="submit" id="updateButton" class="btn btn-primary btn-sm" onclick="enviarData(event)">Notificar</button>
<button type="submit" id="updateButton" class="btn btn-primary btn-sm" onclick="updateData(event)">Update</button>
</div>
</div>
</div>
</div>
</div>
</section>
#endsection
#section('javas')
<script>
$('.tablita').DataTable({
"processing": "true",
"serverSide": "true",
"ajax": "{{route('datatable.paraderivar')}}",
"select": "true",
"columns":[
{data: 'id'},
{data: 'siniestro'},
{data: 'fechaip'},
{data: 'modalidad'},
{data: 'direccion'},
{data: 'localidad'},
{data: 'inspector'},
{data: 'edit'},
]
});
</script>
<script>
$('#addT').hide();
$('#addButton').hide();
$('#updateT').show();
$('#updateButton').show();
$.ajaxSetup({
headers:{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
})
//---------------------------------------------- Llamar datos de la BD ---------------------------------------------------------------
function allData(){
$.ajax({
type: "GET",
dataType: "json",
url: "/teacher/all",
success: function (response){
var data = ""
$.each(response, function(key, value){
data = data + "<tr>"
data = data + "<td>"+value.id+"</td>"
data = data + "<td>"+value.siniestro+"</td>"
data = data + "<td>"+value.fechaip+"</td>"
data = data + "<td>"+value.modalidad+"</td>"
data = data + "<td>"+value.direccion+"</td>"
data = data + "<td>"+value.localidad+"</td>"
data = data + "<td>"+value.inspector+"</td>"
data = data + "<td>"
data = data + "<button class='btn btn-info btn-sm' onclick='editData("+value.id+")'>Asignar</button>"
data = data + "</td>"
data = data + "</tr>"
})
$('tbody').html(data);
}
})
}
// --------------------------------------------- fin de llamar datos de la DB ----------------------------------------------------------
allData();
// --------------------------------------------- Limpiar los campos despues del submit -------------------------------------------------
function clearData(){
$('#siniestro').val('');
$('#fechaip').val('');
$('#inspector').val('');
$('#nameError').text('');
$('#titleError').text('');
$('#instituteError').text('');
}
// --------------------------------------------- fin de limpiar los campos despues del submit -------------------------------------------------
// --------------------------------------------- Agregar registros a la table de BD -------------------------------------------------
function addData(){
var siniestro = $('#siniestro').val();
var fechaip = $('#fechaip').val();
var inspector = $('#inspector').val();
var patente = $('#patente').val();
$.ajax({
type: "POST",
dataType: "Json",
data: {siniestro:siniestro, fechaip:fechaip, inspector:inspector, patente:patente},
url:"/teacher/store/",
success: function(data){
allData();
clearData();
console.log('datos agregados con éxito');
},
error: function(error){
$('#nameError').text(error.responseJSON.errors.name);
$('#titleError').text(error.responseJSON.errors.title);
$('#instituteError').text(error.responseJSON.errors.institute);
}
})
}
// --------------------------------------------- fin de agregar registros a la table de BD -------------------------------------------------
// --------------------------------------------- Editar registros a la table de BD ---------------------------------------------------------
function editData(id){
$.ajax({
type:"get",
dataType:"json",
url:"/teacher/edit/"+id,
success: function(data){
$('#addT').hide();
$('#addButton').hide();
$('#updateT').show();
$('#updateButton').show();
$('#id').val(data.id);
$('#siniestro').val(data.siniestro);
$('#fechaip').val(data.fechaip);
$('#inspector').val(data.inspector);
$('#patente').val(data.patente);
console.log(data);
}
})
}
// --------------------------------------------- Fin de editar registros a la table de BD -------------------------------------------------
// --------------------------------------------- Update de registros a la table de BD -----------------------------------------------------
function updateData(event){
event.preventDefault();
var id = $('#id').val();
var siniestro = $('#siniestro').val();
var fechaip = $('#fechaip').val();
var inspector = $('#inspector').val();
var patente = $('#patente').val();
$.ajaxSetup({
headers:{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
})
$.ajax({
type: "PUT",
dataType: "json",
data: {inspector:inspector, siniestro:siniestro, fechaip:fechaip, patente:patente},
url: "/teacher/update/"+id,
success: function(response){
allData();
clearData();
console.log('Siniestro asignado con éxito');
}
})
}
</script>
#endsection
When the page is reloaded, it seems that the DataTable plugin does not load correctly, since it does not page by 10, but loads all the records and the table becomes large... although I can click on the "assign" button and retrieve the attributes of each record. But, when I search for something in the search bar, the plugin pages 10 records, and when I click on each "Assign" button, it no longer sends me the data, but instead gives me the error "Failed to load resource: the server responded with a status of 404 (Not Found)." When I look at the error detail, it tells me the following: "{message: "No query results for model [App\Models\Siniestro] undefined",…}"

Bootstrap Notification Alerts

I have a Codeigniter project to manage letter details. Then I need to notify no of urgent letters in the menu bar as a Bootstrap notification to each subject users. Urgent letters denoted by 2 (Two) in the classification column.
Controller
public function index()
{
$meta=array(
'UrgentLetters'=>$this->Welcome_Model->getUrgentLetters()
);
$this->load->view('header',$meta);
$this->load->view('dashboard');
$this->load->view('footer');
}
Model
function getUrgentLetters()
{
$subject = $this->session->userdata('subject_id');
$this->db->select("letter_subject.subject_name AS subjects, count(letter_id) AS no_of_urgent");
$this->db->from('letter_letter');
$this->db->join('letter_subject', 'letter_subject.subject_id=letter_letter.subject');
$this->db->where('letter_letter.status=1 and letter_letter.classification=2');
$this->db->group_by('subject_name');
if ($subject && $subject !=100)
$this->db->where('letter_letter.subject', $subject);
$q = $this->db->get();
if ($q->num_rows() > 0) {
return $q;
}
}
View
<li class="dropdown notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-info"><?= count($UrgentLetters) ?></span>
</a>
<ul class="dropdown-menu" style="width: 940px">
<li class="header">You have <?= count($UrgentLetters)?> Urgent Letters</li>
<li>
<!-- Inner Menu: contains the notifications -->
<ul class="menu">
<table style="width: 100%">
<thead style="padding-bottom: 10px">
<tr style="width: 100%">
<th style="width: 40%;padding-left: 2%;padding-bottom: 5px;padding-top: 5px">Subject Name</th>
<th style="width: 40%;padding-bottom: 5px;padding-top: 5px">Letter Count</th>
</tr>
</thead>
<tbody>
<?php foreach ($UrgentLetters as $UrgentLetterss){
$subjects=$UrgentLetterss->subjects;
$no_of_urgent = $UrgentLetterss->no_of_urgent;
echo "<tr>";
echo "<td style='width: 45%;padding-left: 2%'>$subjects</td>";
echo "<td style='width: 45%'>$no_of_urgent->desc</td>";
echo "</tr>";
}?>
</tbody>
</table>
</ul>
</li>
</ul>
</li>
All the sections are working fine. But the following error encountered.
A PHP Error was encountered
Severity: Notice
Message: Undefined property: PDO::$subjects
Filename: views/header.php
Line Number: 111
What may be the reason ? Can anyone help ?
you are missing to return a query result like
if ($q->num_rows() > 0) {
return $q->result();
}
right now you just send a CI_DB_mysqli_result Object and therefor you get the error message in your view.
see Generating Query Results()

applying pagination to a table in angular js where map is what i'm iterating through in ng-repeat

i'm iterating through map where key and value pair is there and i'm not getting how to apply pagination of those data where that map data is generated from the database directly.i'm iterating through map where key and value pair is there and i'm not getting how to apply pagination of those data where that map data is generated from the database directly.
<table>
<thead></thead>
<tbody>
<tr>
<td><marquee>
<h3>
A tag is a keyword or label that categorizes your question with
other, similar questions. Using the right tags makes it easier
for others to find and answer your question.
</h4>
</marquee>
<hr></td>
</tr>
<tr ng-repeat="(key,value) in tagForm.data track by $index">
<td align="left">
<div ng-init='tagForm.getTag(key)'
class=" w3-container w3-card w3-white w3-margin w3-round "
style="padding-left: 40px; padding-right: 40px;">
<br>
<p ng-repeat="data2 in tagForm.message track by $index">
<a ng-click="tagForm.getAnswer(key)">Q. {{value}}</a> <span
class="badge">{{data2}}</span> <br>
</p>
<ul ng-repeat="(key2,value2) in tagForm.ans track by $index">
<li><b ng-if="key==key2">Ans. {{value2}}</b></li>
</ul>
<div ng-init='tagForm.getUser(key)'>
<b>Posted
by:{{tagForm.user2[$index]}}</b>
</div>
<button class="btn btn-default" id="{{$index}}"
ng-click="count1=count1+1" ng-init="count1=5+($index*3)-5">
Upvote <span class="badge">{{count1}}</span>
</button>
<button class="btn btn-default" id="{{$index}}"
ng-click="count=count+1" ng-init="count=1+($index*2)">
Downvote<span class="badge">{{count}}</span>
</button>
<button class="btn btn-default" ng-click="gotoanswer()">Answer
this question</button>
<br> <br />
</div> <br>
</td>
<td height=100px><br /></td>
</tr>
</tbody>
</table>
use the following pagination in your html file
<uib-pagination ng-show="isPaginate == false "
total-items="totalItems" ng-model="currentPage"
boundary-links="true" items-per-page="numPerPage"
class="pagination-sm" ng-change="pageChanged()" max-size="5">
</uib-pagination>
and then initialize the variable as per requirement in angular controller
$scope.totalItems = 80;//length of records
$scope.currentPage = 1;
$scope.numPerPage = 10;
var startpos = 0;
for dynamically loading records (loading records batch wise instead of loading all at time) refer following function
$scope.pageChanged = function() {
// if($scope.currentPage!=1)
$scope.isCollapsed = false;
$scope.isRCollapsed = false;
$scope.page = ($scope.currentPage - 1) * $scope.numPerPage;
callApi($scope.page);//get next set of 10 records
console.log('Page changed to: ' + $scope.currentPage);
};

codeigniter form submission using ajax and display return data in table

I submitting one form in view page and I want to, when I click on submit button the form data need to be saved in a database table and that data need to be shown in the table without refresh page.
Here is my view code:
<div class="col-md-12">
<div class="row">
<div>
<table class="table table-striped table-hover table-responsive">
<thead>
<tr class="">
<th>Director</th>
<th>Partner</th>
<th>Duration</th>
<th>Comments</th>
</tr>
</thead>
<tbody id="hodm_results">
</tbody>
</table>
</div>
</div>
</div>
<?php
$attributes = array('class' => 'form-horizontal','id'=>'hodm_comments');
echo form_open('', $attributes);
?>
<div class="row">
<div class="col-md-12">
<div class="col-sm-3">
<div class="input-group">
<span>Director</span>
<?php echo form_input(['class'=>'form-control autofocus','id'=>'director','name'=>'director','value'=>set_value('director',$wip->director)]); ?>
</div>
</div>
<div class="col-sm-3">
<div class="input-group">
<span>Partner</span>
<?php echo form_input(['class'=>'form-control autofocus','id'=>'partner','name'=>'partner','value'=>set_value('partner',$wip->partner)]); ?>
</div>
</div>
<div class="col-sm-3">
<div class="input-group">
<span>Duration</span>
<?php echo form_input(['class'=>'form-control autofocus','id'=>'duration','name'=>'duration']); ?>
</div>
</div>
<div class="col-sm-3">
<div class="input-group">
<span>Comments</span>
<?php echo form_textarea(['class'=>'form-control autofocus','id'=>'comments','name'=>'comments','rows'=>'3']); ?>
<input type="hidden" name="id_hidden" value="<?php echo $wip->id; ?>">
</div>
</div>
</div>
</div>
<input class="btn btn-primary" type="submit" name="submit" value="submit">
<?php
echo form_close();
?>
</section>
<!--main content end-->
</section>
Here is my JQuery code:
<script type='text/javascript' language='javascript'>
$('#hodm_comments').submit(function (event) {
$.ajax({
url:"<?php echo base_url();?>digital/dashboard/insert_hodm_comments",
type: 'POST',
dataType: 'JSON',
success:function (data) {
$('#hodm_results').html(data);
}
});
event.preventDefault();
});
</script>
Here is my controller code:
public function insert_hodm_comments(){
/* Checking the all validation of Hodm Comment form form*/
$this->form_validation->set_rules('director', 'Name of Director', 'required');
$this->form_validation->set_rules('partner', 'Partner', 'required');
$this->form_validation->set_rules('duration', 'No Of Hours', 'required');
$this->form_validation->set_rules('comments', 'Comments of the task', 'required');
if ($this->form_validation->run()) {
/* Taking the data from form*/
$partner = $this->input->post('partner');
$director = $this->input->post('director');
$duration = $this->input->post('duration');
$comments = $this->input->post('comments');
$id = $this->input->post('id_hidden');
$data = array(
'partner' =>$partner,
'director' =>$director,
'duration' =>$duration,
'comments' =>$comments,
'hodm_id' =>$id
);
$add=$this->pojo->add_hodm_comments($data);
/* Display Success message if data inserted successfully in database*/
if($add){
$result_html = '';
$result_set = $this->pojo->get_hodm_comments();
foreach($result_set as $result) {
$result_html .= '
<tr>
<td>' . $result->director . '</td>
<td>' . $result->partner . '</td>
<td>' . $result->duratrion . '</td>
<td>' . $result->comments . '</td>
</tr>';
}
echo json_encode($result_html);
//$this->session->set_flashdata('hodm_form',"All HODM Data Inserted Successfully.");
//$this->session->set_flashdata('hodm_form_class','alert-success');
}else{
/* Displaying the error message*/
$this->session->set_flashdata('hodm_form',"failed to add, Please Try again");
$this->session->set_flashdata('hodm_form_class','alert-danger');
}
return redirect('digital/dashboard/wip_hodm_comments_section');
} else {
$this->load->view('digital/hodm/dashboard_hodm_work/wip_hodm_comments');
}
}
Here is Model:
public function add_hodm_comments($data){
$this->db->insert('hodm_wip_comments', $data);
return TRUE;
}
public function get_hodm_comments(){
$this->db->select('*');
$this->db->from('hodm_wip_comments');
$query=$this->db->get();
return $result=$query->result();
}
Please help me to find the solution I stuck in this code.
Thank you
Just change your ajax part to below
<script type='text/javascript' language='javascript'>
$('#hodm_comments').submit(function (event) {
$.ajax({
url:"<?php echo base_url();?>digital/dashboard/insert_hodm_comments",
type: 'POST',
data : $('#hodm_comments').serialize(),
success:function (data) {
$('#hodm_results').html(data);
}
});
event.preventDefault();
});
</script>
and in your controller change this echo json_encode($result_html); to echo $result_html;
this works perfect in my side with your code :)
What you can do simply is to echo response from within your controller function, get the return data of ajax call and add it into a div or as tr in to an existing table.

Use custom data source in angular UI template

I am using ui-bootstrap-tpls to render datepicker in my angular view. I have customized the template in this way :
customDatePicker.html
<script id="template/datepicker/day.html" type="text/ng-template">
<table role="grid" aria-labelledby="{{uniqueId}}-title" aria-activedescendant="{{activeDateId}}">
<thead>
<tr>
<th>
<button type="button" class="btn btn-default btn-sm pull-left" ng-click="move(-1)" tabindex="-1">
<i class="glyphicon glyphicon-chevron-left"></i>
</button>
</th>
<th colspan="{{5 + showWeeks}}">
<button id="{{uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm" ng-click="toggleMode()" tabindex="-1" style="width:100%;">
<strong>{{title}}</strong>
</button>
</th>
<th>
<button type="button" class="btn btn-default btn-sm pull-right" ng-click="move(1)" tabindex="-1">
<i class="glyphicon glyphicon-chevron-right"></i>
</button>
</th>
</tr>
<tr>
<th ng-show="showWeeks" class="text-center"></th>
<th ng-repeat="label in labels track by $index" class="text-center">
<small aria-label="{{label.full}}">{{label.abbr}}</small>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in rows track by $index">
<td ng-repeat="dt in row track by dt.date" class="text-center" role="gridcell" id="{{dt.uid}}" aria-disabled="{{!!dt.disabled}}">
<button type="button" style="width:100%;" class="btn btn-default btn-sm" ng-click="select(dt.date); openCustomDialog(dt.date)" ng-disabled="dt.disabled" tabindex="-1">
<span>{{dt.label}}</span>
</button>
</td>
</tr>
</tbody>
</table>
</script>
<datepicker ng-model="dt" min-date="minDate" show-weeks="true" class="well well-sm"></datepicker>
It's working fine. The problem I am facing is that I have to use custom data in the template in
<tbody>
<tr ng-repeat="row in rows track by $index">
<td ng-repeat="dt in row track by dt.date" class="text-center" role="gridcell" id="{{dt.uid}}" aria-disabled="{{!!dt.disabled}}">
<button type="button" style="width:100%;" class="btn btn-default btn-sm" ng-click="select(dt.date); openCustomDialog(dt.date)" ng-disabled="dt.disabled" tabindex="-1">
<span>{{dt.label}}</span>
</button>
</td>
</tr>
</tbody>
For ex. I have to add class(to change color) for some kind of event.
Please help.
This is best solved using a directive inserted in the template. (Heres an updated plunker) Notice the highlight-day="dt" directive inserted here. This will bring each day into our custom directive to determine if we need to highlight the day. I prefer this method of highlight as opposed to performing surgery on third party javascript.
<button highlight-day="dt" ng-class="{selected: dt.highlighted}" type="button" style="width:100%;" class="btn btn-default btn-sm" ng-click="select(dt.date); openCustomDialog(dt.date)" ng-disabled="dt.disabled" tabindex="-1">
<span>{{dt.label}}</span>
</button>
Once we have that, we can add a directive that looks like follows. Notice all the logic is done in the link function.
app.directive("highlightDay", ["myCustomObj", "monthMapper", function(myCustomObj, monthMapper){
return {
restrict: "A",
//This brings the value of attribute into our current scope as an object, not just a DOM string
scope: {
highlightDay: "="
},
link: function(scope, element, attrs, ctrls) {
//Make the native date object as a local variable
var dt = scope.highlightDay.date;
//Find out what the month name should be
var monthName = monthMapper[dt.getMonth()];
//Loop through all the possible selected dates
for(var i in myCustomObj){
var entry = myCustomObj[i];
//If the month and day match
var isMatch = entry.month === monthName && entry.day === dt.getDate();
if(isMatch) {
scope.highlightDate.highlighted = isMatch
break;
}
}
}
};
}]);
You also notice the two other dependencies, myCustomObj and monthMapper. These are defined elsewhere angular and could be as I have done below.
app.constant("monthMapper", [
"january",
"february",
"march",
"april",
"may",
"june",
"july",
"august",
"september",
"november",
"december"
]);
app.value("myCustomObj", [{
"month" : 'june',
"day" : 19
},
{
"month" : 'june',
"day" : 28
}
]);
As a side note, you could speed up time determining if the day should be selected by reorganizing myCustomObj maybe something like this.
{
june: [19, 28]
}
I think that the best and fastest way to change the template is first copy the same template and make the adjustments on him as the template already has all the events and necessary classes binded.
The second solution for you is to take all the parts of ng-{{event}} (ng-class, ng-click, ng-...) and to connect them to your template in the same place.
Hope it make sense to you.