Skip to content

Instantly share code, notes, and snippets.

View anjanawijesundara's full-sized avatar

Anjana Wijesundara anjanawijesundara

View GitHub Profile
@anjanawijesundara
anjanawijesundara / index.html
Last active August 29, 2015 14:21
AngularJS Two-way Binding (view)
<div ng-controller="CustomerController" class="container">
<div class="form-group">
<label for="name">Name</label>
<input class="form-control" type="text" ng-model="customer.name" ng-bind="customer.name" required />
</div>
<div class="form-group">
<label for="email">Email</label>
<input class="form-control" type="text" ng-model="customer.email" ng-bind="customer.email" required />
</div>
<div class="form-group">
@anjanawijesundara
anjanawijesundara / CustomerController.js
Last active August 29, 2015 14:21
Angular Two-way Binding (Controller)
app.controller('CustomerControler',[ function ($scope) {
$scope.customer = {
name : 'Anjana Wijesundara',
email: 'wsanjana951@gmail.com',
username: 'anjanaw'
};
}]);
@anjanawijesundara
anjanawijesundara / Customer.php
Created April 25, 2015 15:59
Getting Start with Codeigniter by creating a CRUD application [Customer.php part 4 delete method]
public function delete($username = NULL){
$this->customer_model->delete_customer($username);
$this->load->view('customer/success');
}
@anjanawijesundara
anjanawijesundara / Customer_model.php
Created April 25, 2015 15:58
Getting Start with Codeigniter -Ccreating a CRUD Application [Customer_model.php Part 4 delete_customer ]
public function delete_customer($username = FALSE){
if ($username != FALSE){
return $this->db->delete('customer', array('username' => $username));
}
}
@anjanawijesundara
anjanawijesundara / Customer_model.php
Created April 25, 2015 15:41
Getting Start with Codeigniter -Ccreating a CRUD Application [Customer_model.php Part 3 set_customer and update_customer ]
public function set_customer(){
$data = array(
'username' => $this->input->post('username'),
'full_name' => $this->input->post('full_name'),
'email' => $this->input->post('email')
);
return $this->db->insert('customer', $data);
}
@anjanawijesundara
anjanawijesundara / Customer.php
Created April 25, 2015 15:31
Getting Start with Codeigniter by creating a CRUD application [Customer.php part 3 edit method]
public function edit($username = NULL){
$this->load->helper('form');
$this->load->library('form_validation');
$data['customer_item'] = $this->customer_model->get_customer($username);
$data['title'] = 'Customer Update';
//$this->load->view('customer/edit', $data);
@anjanawijesundara
anjanawijesundara / Customer.php
Created April 25, 2015 15:29
Getting Start with Codeigniter by creating a CRUD application [Customer.php part 2 create method]
public function create(){
$this->load->helper('form');
$this->load->library('form_validation');
$data['title'] = 'Create a news item';
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('full_name', 'Full Name', 'required');
$this->form_validation->set_rules('email', 'Email', 'required');
@anjanawijesundara
anjanawijesundara / edit.php
Created April 25, 2015 15:25
Getting Start with Codeigniter by creating a CRUD application [edit.php- view page]
<h2><?php echo $title ?></h2>
<?php echo validation_errors(); ?>
<?php echo form_open('customer/edit') ?>
<label>Username</label>
<input type="input" name="username" value="<?php echo $customer_item['username']?>"/><br />
<label for="text">Full Name</label>
<input type="input" name="full_name" value="<?php echo $customer_item['full_name']?>"/><br />
@anjanawijesundara
anjanawijesundara / create.php
Created April 25, 2015 15:24
Getting Start with Codeigniter by creating a CRUD application [create.php- view page]
<h2><?php echo $title ?></h2>
<?php echo validation_errors(); ?>
<?php echo form_open('customer/create') ?>
<label>Username</label>
<input type="input" name="username" /><br />
<label for="text">Full Name</label>
<input type="input" name="full_name" /><br />
@anjanawijesundara
anjanawijesundara / view.php
Created April 25, 2015 15:19
Getting Start with Codeigniter by creating a CRUD application [view.php- view page]
<h2><?php echo $title ?></h2>
<label>Username</label>
<p><?php echo $customer_item['username']?></p>
<label for="text">Full Name</label>
<p><?php echo $customer_item['full_name']?></p>
<label for="text">Email</label>
<p><?php echo $customer_item['email']?></p>