Monday, 16 May 2016

Changing button text (toggle text) on click in AngularJS



Changebuttontextin angularJS.jpg

We can make a button behave like a toggling button by making a directive in AngularJS. It is very simple. You just need to bind the attribute and then check the condition.
First create a simple HTML :-
  1. <html>
  2.   <head>
  3.       <link rel="stylesheet" type="text/css" href="css/index.css">
  4.       <link rel="stylesheet" type="text/css" href="css/myApp.css">
  5.       <title>Hello World</title>
  6.   </head>
Read the full blog about Changing button text (toggle text) on click in AngularJS visit Findnerd.

Findnerd is also a best place to solve your Tech Query, Ask Questions etc.

Tuesday, 26 April 2016

Promises in Angular.JS


Angular.jpg

By using Promises we can execute a function asynchronously. we can use promises to specify what to do when a operation is success or failed. We have $q built in keyword in angular js for promises. let's create a example :
  1. .service('drawHomeCardService', function(apiCallFactory, $q) {
  2.   this.getTheLogo = function() {
  3.       var deferred = $q.defer();
  4.       apiCallFactory.getData().success(function(response) {
  5.           var logo         =  response[2].businessInfo.logoFilePath;
  6.           var logoFilePath = 'https://oyokeydev.s3.amazonaws.com/' + logo;
  7.           deferred.resolve(logoFilePath);
  8.       }).error(function(response) {
  9.           console.log('Something went wrong');
  10.           deferred.reject('Something went wrong');

Read full blog at our highly specific C, PHP, Java, iPhone, Javascript Questions, about the topic described above "Promises in Angular.JS". You can also learn much more about different programming technologies and can enhance your tech skills.