Monday, September 5, 2016

In html side

<a our-click="save()">Save</a>

In angularjs side(JavaScript)

.directive('ourClick', function() {
     return function(scope, element, attrs) {
        event.stopPropagation();
          selement.bind('touchstart click', function(event) {
          event.preventDefault();
          cope.$apply(attrs.
ourClick);
        });
     };
});

state = false;
changeState(state){
state = true;
}
log(state);

In the above code
  • If we are passing by value, output is false
  • If we are passing by reference, out put is true.

See the simple example :

Sunday, September 4, 2016

Tilde(~) :
Tilde matches the most recent minor version (the middle number). ~1.1.1 will match all 1.1.x versions but will miss 1.2.0.
Caret(^) :
Caret matches the most recent major version (the first number). ^1.1.1 will match any 1.x.x release including 1.2.0, but will hold off on 2.0.0.

Note: Just use 0.0.x instead of ~0.0.0. The first is less obscure.

Wednesday, November 4, 2015


Logfile is a file that records either events that occur in an operating system or other software runs, or messages between different users of a communication software.Logging is the act of keeping a log. In the simplest case, messages are written to a single logfile. more...

A simple node console and file logger suitable for small, medium and large projects.To this we need to install simple-node-logger node modules.To that type this in your command line.
npm install simple-node-logger --save

To create a logger in console view :
var log = require('simple-node-logger').createSimpleLogger();
To create a logger in separate file project.log in your working directory:
var log = require('simple-node-logger').createSimpleLogger('project.log');

In the log have some levels include the standard set: trace, debug, info, warn, error and fatal levels (plus all and off). The default level is info. The log level can be set at run-time by doing this:
warn to set the log level see here:
log.setLevel('warn');

Sample log here:
var log = require('simple-node-logger').createSimpleLogger();
log.info("Log starting...");
log.warn("This is warning");
log.info("THis is info");


Category Logger

If you create a logger with a category name, all log statements will include this category. Typically a category is a class or module name. If you create a logger with the category name 'MyCategory', the log statement would format like this:
14:14:21.363 INFO  MyCategory subscription to

A simple multi-level logger for console, file, and rolling file appenders. Features include:
  • flexible appender/formatters with default to HH:MM:ss.SSS LEVEL message
  • add appenders to send output to console, file, rolling file, etc
  • change log levels on the fly
  • domain and category columns
  • overridable format methods in base appender

Wednesday, October 28, 2015

If you are not using ng-bind, instead something like this {{text}}. You might see the actual {{text}} for a second before text is resolved (before the data is loaded).
So you could do something like this<span ng-bind="text"> or <span ng-bind-html="text">

Monday, October 12, 2015

Arrays 

JavaScript arrays are used to store multiple values in a single variable, which can hold more than one value at a time. Arrays are a special type of objects, So typeof operator in JavaScript returns "object" for arrays. Arrays use numbered indexes.  
Example: var names= ["Chanthan", "Jack", "Jhon"];
Arrays use numbers to access its "elements". For this example, names[0] returns Chanthan.

Objects

Objects use names to access its "members". Objects use named indexes.
Example: var person = {firstName:"Chanthan", lastName:"Ratn", age:25};
For this example, person.firstName returns Chanthan.


In array, If you use a named index, JavaScript will redefine the array to a standard object. After that, all array methods and properties will produce incorrect results.
Example:
var size = person.length; // person.length will return 0 
var name= person[0]; // person[0] will return undefined

So how to get the length of a object  in JavaScript object (that is, associative array)
Object.size = function(obj) {
    var size = 0, key;
    for (key in obj) {
        if (obj.hasOwnProperty(key)) size++;
    }
    return size;
};
//get the length of array object
var size = Object.size(array);

So, When to Use Arrays. When to use Objects.
  1. JavaScript doesn't support associative arrays.
  2. Use objects when you want the element names to be strings (text).
  3. Use arrays when you want the element names to be numbers.

Thursday, October 8, 2015

Free and open source, Ionic offers a library of mobile-optimized HTML, CSS and JS components, gestures, and tools for building highly interactive apps. Built with Sass and optimized for AngularJS. more...

Step 1
First you need to install latest nodejs and python then set path variable also.


Step 2
I'm consider windows os. Open the command window and type this
npm install -g cordova ionic
After the installation make sure npm version
 
npm -v


Step 3
Create an Ionic project using one of our ready-made app templates, or a blank one to start fresh.
open command prompt where you like to create your project, then type this
ionic start myApp blank
Or
ionic start myApp tabs
Here I follow tabs app. Open the folder, folder should be like this




Step 4
Make sure your in inside the project folder in command prompt, then to start the app type
ionic serve
Now your app successfully started in your browser.

http://localhost:8100
 
Note: Make sure any servers not running port 8100.

Now we see the project structure, Open app your favorite IDE

Popular Posts

Recent Posts

Unordered List

Text Widget

Powered by Blogger.

Popular Posts