Skip to main content

Posts

Showing posts from 2015

ng-style in angular directive

An ng-style is a directive to use css style properties and all component is to make design. The design properties is make controller scope object is created and than the object is set to ng-style value. Syntax: <div ng-style="expression"></div> AngularScript: <div ng-app="colorApp"> <div ng-controller="ColorCtrl">     <input type="button" value="set color" ng-click="demo()">       <span ng-style="myStyle">Sample Text</span>     <pre>myStyle={{myStyle}}</pre> </div> </div> var app = angular.module('colorApp',[]); app.controller('ColorCtrl', function($scope){   $scope.myStyle = {};      $scope.demo = function(){  $scope.myStyle = {      'color': 'green',      'font-size': '42px',      'font-family': 'Arial,Helvetica Neue,Helvetica,sans-serif'    };  } }); span {     color: re

Cachefactory in angularjs

$cacheFactory :             A cache is object, this will store and get cache data. Why we can use cache ? the reason is increase the speed of retrieve data access. Because increase the performance of application. This Cache have 5 methods: info() - The details about cache object properties. put(key, value) - Push the details of key,value object; get(key) - Get the details of pushed objects; remove(key) - Remove a specific object; removeAll() - Remove all pushed objects; destroy() - Clear the cache object; Angular Code : <div ng-app="cacheApp">     <div ng-controller="CacheCtrl">         Data {{information()}}     </div> </div> var app = angular.module("cacheApp", []) app.factory('myCache' , function($cacheFactory) {     return $cacheFactory('mycache' , { capacity : 3 }) }); app.controller('CacheCtrl', function($scope, myCache) {     var data = {id:10, name:&q

ng-include in angularjs

Ng-include Directive :         An ng-include is use to inject a DOM in any html pages. This inject DOM component is active scope in mention or declared controllers.        A purpose of ng-include is reuse the DOM component in more than pages. Say for example header page section is common to the all pages means, This DOM element move to one file and than this file include all the pages. <ng-include src="" onload="" autoscroll="">   or <div ng-include="" onload="" autoscroll=""> src  - give your dom component file path. onload - any action you will make on load the dom autoscroll - if need scroll you can apply here Sample: <div ng-include="'templates/include/header_tpl.html'"></div>  or <div ng-include="'templates/include/header.tpl'"></div> .tpl or .html you save the template file format. These format is support

Angularjs $log

Angularjs have a $log directive, This directive major use for to identification debugging and program execution flow understand. It's also safe console message services. $log Directive Methods Method Description Example log() Can write a logger message from this method $log.log($scope.message); info() Can write a logger message for your infomation $log.info($scope.message); warn() Can write a logger message for warning $log.warn($scope.message); error() Can write a logger message for error $log.error($scope.message); debug() Can write a logger message for debug $log.debug($scope.message); $log Example: var app = angular.module("LogApp",[]); app.controller("LogCtrl",function($scope, $log){     $scope.message = "This is sample implementation of $log directive";        $log.log($scope.message);    $log.info($scope.message);    $log.warn($scope.message);    $log.error($scope.message);    $log.deb

Password mismatch validation in angularjs

Angular using to apply password mismatch validation in the form. We need a password match validation, When i interred my password field value say for example admin(*****) and conform password field will inter match the same value from the field. The value are match means set flag for a variable is True or   mismatched the value means it will set Fasle.  Based this flag value to show the message form to apply directive of ng-show. This logic apply email validation also. AngularJS: var app = angular.module('frmVal',[]); app.controller('FrmCtrl', function($scope){     $scope.pwd = "";     $scope.cpwd = "";       $scope.isMatch = true;       $scope.$watch('pwd', function(newValue, oldValue){         if(newValue == $scope.cpwd)         {             $scope.isMatch = false;         } else {             $scope.isMatch = true;         }     });     $scope.$watch('cpwd', function(newValue, oldValue){         if(newVal

Fiksu integration by cordova mobile application

Fiksu: A fiksu is a advertisement agency in various media domain. Especially in mobile application side more effectively analysis by mobile users. Their best to do the ads on your application and collective revenue  and pay to the yours. Fiksu Integration Steps:(Install Linux or Ubuntu) 1.  Create an account from fiksu site as following URL https://dashboard.fiksu.com/en/signin . 2.  Singin your credential from this site. 3. Download the fiksu SDK files Download . 4.Then open your terminal and type android command. Open Android SDK manager widget is select Extra package inside play related package list item is select and install it. 5. Now extract fiksu SDK downloaded and get Path details and execute following command. cordova plugin add com.fiksu.sdk --searchpath home/user/Fiksu-SDK-for-Cordova-1.2.0/Library/plugin --noregistry 6. Add the following code from your index.html inside of the javascrip blog. Android: onDeviceReady: function() { app.receive

Angularjs Button

HTML input element is have properties as following ng-model and ng-value as declare dynamic change the event fire on button click. A button ng-value is change on when event is fire, This logic is apply into ng-model component value is replace the ng-value block. Sample HTML Code: <div ng-app="BtnApp"> <div ng-controller="BtnCtrl">     Do you want Car?     <input type="button" ng-model="youWantCar" ng-value="youWantCar" ng-click="changeStatus()"/> </div>     </div> AngularJS: var app = angular.module('BtnApp', []); app.controller('BtnCtrl',function($scope){     $scope.youWantCar = "No";     $scope.changeStatus = function(){         if($scope.youWantCar == "No")             $scope.youWantCar = "Yes";         else             $scope.youWantCar = "No";     };           }); Result: Demo

A simple start and stop timer counter in angularjs

     AngularJs using to create a start and stop counting timer functionality application. This application is need the following directive like $interval and $filter , We create default time object is display current timer clock functions.         A timer counter is have three functionality as below that start, stop and reset. A start function is called to start the $ interval directive to active so now counter is begin, This moment you are unable to proceed a reset logic.         Stop function is is call to $ interval belongs one of the method like cancel , This method make corresponding active interval prose is stop it. Reset function is call to reset all scope value is to be zero. HTML: <div ng-app="timerApp">     <div ng-controller="timerController">         Current Time : {{time}} <br/>         <hr/>                <Button ng-click="timer_start()">Start</Button>         <Button ng-click=&

ng-Init in angularjs

Ng-init is a local scope of DOM controller in the region. In the ng-init blog is declare a variable, This variable have to scope of current Controller. Syntax: <div ng-init="variable"> </div> Example: <div ng-app="appInit">     <div ng-controller="appCtrl">         <div ng-init="items =  (data | orderBy:'name')">                        <div ng-repeat="item in items">                 {{item.name}} - {{item.mobile}}             </div>         </div>     </div> </div> AngularJS: var app = angular.module('appInit',[]); app.controller('appCtrl',function($scope){     $scope.data = [         {name:'sathiya',mobile:'9865988754'},         {name:'rajesh',mobile:'9887879856'},                   {name:'mani',mobile:'5487548754'}     ]; }); Result: Demo

ng-messages in angularjs

         mg-message is a directive with the purpose of show and hide the directive based on validation or condition of Object. This Object reference of ng-messages base Object defend to key/value base to map the component display inside of ng-message . Syntax: <Div ng-messages = "expression" role = "alert" > <Div ng-message = "Value" > ... </Div> <Div ng-message = "Value1, Value2, ..." > ... </Div>     </Div> HTML : <div ng-app="msgApp">     <div ng-controller="msgCtrl">         <form name="msgForm">             <input type="text" name="userName" ng-model="user_name" ng-maxlength="20" ng-minlength="5" required />                         <pre>{{ msgForm.userName.$error | json }} </pre>             <div ng-messages="msgForm.userName.$error" style="color:m

Hijacking WhatsApp Account in Seconds Using This Simple Trick

           The badly accepted smartphone messaging annual WhatsApp, acquired by Facebook for over $20 billion endure year, has reportedly been begin to be decumbent to hijacking after unlocking or alive your accessory password, authoritative its hundreds of Millions of users accessible to, not just hackers, but aswell non-technical people.           This ambush lets anyone surrounds you to get finer ascendancy over your WhatsApp account. The antagonist needs annihilation added than a buzz amount of the ambition being and admission to the ambition adaptable buzz for a few seconds, even if it is locked. Hacking Whatsapp annual in such book is not harder for your accompany and colleagues. This is not in fact a artifice or vulnerability in WhatsApp, and rather it is just the way WhatsApp is advised and its annual bureaucracy apparatus works.  NOTE : Moreover, we aren’t auspicious users to drudge others WhatsApp account, but the purpose of publishing this commodit

I keep 200+ Browser Tabs Open, and My Computer Runs Absolutely Fine. Here's My Secret

I don't apperceive about your part, but I accomplish abundant use of tabs. I currently accept 200+ tabs attainable in my Google Chrome Web browser. And sometimes the amount is even more.  For me it's a circadian thing, as I consistently attainable new tabs because of my addiction of account lots of being online, including cyber aegis updates, hacking news, abreast online writing of assorted categories, new recipes to baker something adorable and, of course, funny viral videos. Browsers — Aggregate for us, But Biggest Anamnesis Eaters! I anticipate you’ll accede with me if I say: It’s absolutely harder to administer so abounding tabs on Chrome — and Firefox too. But worse still is the obstruction in the achievement of your computer, as the tabs abide to run accomplishments processes and augment on your system’s memory.  It gets difficult to array through them, aggregate slows down, and sometimes it crashes the browser itself.  Doesn’t it?   

Turning 'Shadow IT' into 'Better IT'

        No alone apparatus will active you to every accessible new technology out there. It's easier and about added able if you accept the affectionate of accord that encourages business teams to acquaint you about it instead -- alluringly after your accurately asking. That blazon of accord is aswell key to answering the added important questions: that is, why and how they're appliance a accurate technology.          There is an age-old Chinese adage about a agriculturalist who loses his horse. For those who haven't heard it, the adventure goes like this: There's an old agriculturalist who lives with his son abutting to the borderlands. One day, his horse runs away. His neighbors appear to animate him, but he alone says, "how do you apperceive it isn't fortunate?"          A few months later, his horse allotment and brings aback with it a arresting stallion. His neighbors appear again, this time to congratulate him. He says to them, "how do y

Google throws Dart language over to GitHub

        Google has confused Dart, its battling to JavaScript, to GitHub, with the declared absorbed of authoritative it easier to plan with the Dart community.         Developers can accord to the accent at Dart's GitHub page. "The Dart SDK now has its own repository, abutting the abundant Dart accoutrement and bales already in our GitHub org [repository]. We've confused all the SDK issues over (keeping the aboriginal affair numbers), and dartbug.com now credibility to GitHub's affair tracker for the Dart SDK," said Seth Ladd, Google Chrome developer advocate, in a contempo blog post.         Dart, which compiles to JavaScript, has had its plan cut out for it aggressive with not alone the all-over JavaScript, but added JavaScript alternatives, such as CoffeeScript and TypeScript . An analyst, however, angle Google's affective Dart to GitHub as not necessarily a setback or a acknowledgment by Google. "It could just as calmly announce that they w

Search from list using angularjs

        An array have list of n number items is available in a array object. This object will listout using ng-repeat to list items. We take sample example for counties, we have list item show in the DOM pages. This item is have all counties, i want specific country is available from the list to check using angular filter concept. Filter is apply to search a specific country from the list.         This fetch ng-repeat filter concept using angular, this is fetch a corresponding scope of array object only. This happen DOM itself, no need to write logic from. HTML:    <div ng-app="searchApp"> <div ng-controller="searchCtrl">     Search : <input type="text" ng-model="search"/>     <ul ng-repeat="country in countries | filter:search">         <li>{{country.name}}</li>     </ul>     <p ng-show="(countries | filter:search).length==0"> No search result</p> </div>

Angular undefined

An angularjs variable define is have a assign any value or not to find a default properties is angular.isUndefined. I will give a sample logic is undefined checking logic. HTML Code <div ng-app="testApp">     <div ng-controller="TestCtrl">         Variable $scope.name is undefined ==>> {{value1}}         <br/>        Variable $scope.place is undefined ==>> {{value2}}     </div> </div>   AngularJS  var app = angular.module('testApp',[]); app.controller('TestCtrl', function($scope){     $scope.name;     $scope.value1 = angular.isUndefined($scope.name);     $scope.place = "chennai";     $scope.value2 = angular.isUndefined($scope.place); }); Result: Demo

Custom Filter for AngularJS

              Angular directive implements to custom filter concept is apply to filter large data array object will filter specific terms and condition write to yours. Angularjs have some basic filters directive is there. Some more filter need your project means, will try own filter concept is available from angularjs.            Custom filter is more reuse more project from this custom logic. This filter like a library, this write same file or external also. I have sample array Object:   $scope.supplierList =  [         {             "productname": "heliumcylinder",             "catagoriesName": "cylinder"         },         {             "productname": "boost",             "catagoriesName": "cylinder"         },         {             "productname": "test 3",             "catagoriesName": "cylinder"         },         {      

AngularJS using ng-switch Directive

What is ng-Switch               The ng-Switch directive will used for condition swap the DOM elements. This directive is support the scope of angular variable, The DOM is enable means when the matched ng-switch-when properties is equal. This properties compare into String only.              ng-switch-when case more than matched DOM value also return. It will like unique and duplicated both will return from the ng-switch directive. HTML : <div ng-app="switchApp">     <div ng-controller="SwitchCtrl">         <div ng-switch= "grade">             <div ng-switch-when="A">You got A Grade</div>                         <div ng-switch-when="B">You got B Grade</div>             <div ng-switch-when="C">You got C Grade</div>             <div ng-switch-when="D">You got D Grade</div>             <div ng-switch-when="E">Yo

Angular Function Components

AngularJS Function Components :              We focus ng function components. It will support to do a set of basic task to done. This component to manipulate into all set of function to all angular components. Like will do a list of functions angular.lowercase - This function will converted string into lowercase. angular.uppercase - This function will converted string into uppercase. angular.isNumber - Determinate whether a number variable into find. angular.isString - Determinate whether a string variable into find. angular.isArray - Determinate whether a array variable into find. angular.isObject - Determinate whether a Object variable into find. The above List have some basic will refer more into  angularjs. HTML Code: <div ng-app="isApp">     <div ng-controller="isCtrl">         Cos value is {{cos}} <br>         {{firstString}} <br>         Sin value is {{sin}}<br>         {{secondString}}     </div

ng-Class using angularjs Example

ng-Class in angularJS         ng-Class directive to manage a css properties from the DOM Objects. This directive very support to user presentation css apply dynamically and more response, angularjs used for bootstrap css only. Write different properties from the css file and enable from the controller scope object values. HTML:    <div ng-app="classApp">     <div ng-controller="ClassCtrl">        <span ng-if="showValue">         <p ng-class ="{'red': show, 'green': show1}">{{name}}         </p>         </span>          <span ng-if="!showValue">         <p ng-class ="{'red': show, 'green': show1}">{{name}}         </p>         </span>     </div> </div> Angular Script: var app = angular.module('classApp',[]); app.controller('ClassCtrl',function($scope){     $scope.na