NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

(function(){
var app = angular.module('starter', ['ionic']);
app.config(function($stateProvider, $urlRouterProvider){
$stateProvider.state('add', {
url: '/add',
templateUrl: 'templates/add.html',
controller: 'AddCtrl'
});
$stateProvider.state('list', {
url: '/list',
templateUrl: 'templates/list.html',
cache: false,
controller: 'AppCtrl'
});
$stateProvider.state('edit', {
url: '/edit/:userId',
templateUrl: 'templates/edit.html',
controller: 'EditCtrl'
});
$stateProvider.state('adduser', {
url: '/adduser',
//template: 'Hi',
cache: false,
controller: 'ShowPop'
});
$urlRouterProvider.otherwise('/list');
});

app.controller('AppCtrl', function($scope, $ionicPopup, $http,$state,$stateParams){
$http({
method: "GET",
url: " /contactlists",
//crossDomain : true,
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
}).success(function(data){
//fconsole.log(data);
$scope.contactlist = data;
});
// A confirm dialog
$scope.delete = function(id) {
var confirmPopup = $ionicPopup.confirm({
title: 'Record Will be Delete',
template: 'Are you sure you want to delete this Record?'
});
confirmPopup.then(function(res) {
if(res) {
console.log(id);
//console.log('You are sure');
$http.delete(' /contactlists/'+id).then(function(response){
$state.transitionTo($state.current, $stateParams,{reload: true});
//A Alert Popup
var alertPopup = $ionicPopup.alert({
title: 'User Deleted Successfully',
template: 'Please Click OK'
});
alertPopup.then(function(res) {
console.log('Thank you for not eating my delicious ice cream cone');
});
})
} else {
console.log('You are not sure');
}
});
};
});

app.controller('ShowPop', function($scope, $ionicPopup, $http,$state,$stateParams){
// Triggered on a button click, or some other target// $scope.showPopup = function() {
$scope.contact = {};
// An elaborate, custom popup
var myPopup = $ionicPopup.show({
template: '<label class="item item-input item-stacked-label"><span class="input-label">Name</span>'
+'<input type="text" ng-model="contact.name"></label><label class="item item-input item-stacked-label">'+
'<span class="input-label">Email</span><input type="text" ng-model="contact.email"></label>'+
'<label class="item item-input item-stacked-label"><span class="input-label">Number</span>'+
'<input type="number" ng-model="contact.number"></label>',
title: 'Add User',
subTitle: 'Please Give User Informations',
scope: $scope,
buttons: [
{ text: 'Cancel',
onTap: function(e) {
$state.go('list');
}
},
{
text: '<b>Save</b>',
type: 'button-positive',
onTap: function(e) {
if (!$scope.contact.name || !$scope.contact.email || !$scope.contact.number) {
//don't allow the user to close unless he enters wifi password
e.preventDefault();
} else{
return $scope.contact;
}
}
}
]
});

myPopup.then(function(res) {
console.log('Tapped!', res);
if(res){
$http.post(' /contactlists',$scope.contact).then(function(response){
$scope.contact = "";
$state.go('list');
//A Alert Popup
var alertPopup = $ionicPopup.alert({
title: 'User Added Successfully',
template: 'Please Click OK'
});
alertPopup.then(function(res) {
console.log('Thank you for not eating my delicious ice cream cone');
});
});
}
});
//$timeout(function() {
// myPopup.close(); //close the popup after 3 seconds for some reason
//}, 3000);
//};
});

app.controller('AddCtrl', function($scope, $stateParams, $http, $state){
$scope.adduser = function(contact){
console.log(contact);
$http.post(' /contactlists/',contact).then(function(response){
$scope.contact = "";
$state.go('list');
});
};
});

app.controller('EditCtrl', function($scope, $stateParams, $http, $state,$ionicPopup){
var id = $stateParams.userId;
console.log(id);
$http.get('/contactlists/'+id).success(function(response){
$scope.contact = response;
});
$scope.update = function(){
console.log($scope.contact._id);
$http.put(' /contactlists/' + $scope.contact._id, $scope.contact).success(function(response){
$state.go('list');
//A Alert Popup
var alertPopup = $ionicPopup.alert({
title: 'User Updated Successfully',
template: 'Please Click OK'
});
alertPopup.then(function(res) {
console.log('Thank you for not eating my delicious ice cream cone');
});
});
};
});

app.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
// Don't remove this line unless you know what you are doing. It stops the viewport
// from snapping when text inputs are focused. Ionic handles this internally for
// a much nicer keyboard experience.
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
});
}());
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.