Advertisements

Archive

Archive for the ‘AngularJs’ Category

Disable click outside of bootstrap model area to close modal

December 11, 2015 Leave a comment

Hello Friends following is the solution to disable outside click of bootstrap modal area

If you opening the modal by js use following:

$('#myModal').modal({backdrop: 'static', keyboard: false}) 

Or 

You can define your modal behavior, defining data-keyboard and data-backdrop.

<div id="modal" class="modal hide fade in" data-keyboard="false" data-backdrop="static">
Hope this help !

Advertisements

AngularJS: Bootstrap Datepicker not working inside bootstrap modal Issue

November 17, 2015 Leave a comment

Issue :

The datepicker is working fine in all pages but when we add it inside a bootstrap modal (link below) it stop working.

Bootstrap Modal:

http://getbootstrap.com/2.3.2/javascript.html#modals

Same code is working in normal html files like below

http://jsfiddle.net/rahuladmin/6f4a6097/2/

 

Solution:

You need to call datepicker() in Modal itself like below:

datepickerInModal

 

Hope it helps

open modal popup using angularjs Bootstrap

November 3, 2015 Leave a comment

Formatting phone number with AngularJS

July 17, 2015 1 comment

——————————————————————–

Javascript

angular.module(‘ng’).filter(‘tel’, function () {
return function (tel) {
if (!tel) { return ”; }

var value = tel.toString().trim().replace(/^\+/, ”);

if (value.match(/[^0-9]/)) {
return tel;
}

var country, city, number;

switch (value.length) {
case 10: // +1PPP####### -> C (PPP) ###-####
country = 1;
city = value.slice(0, 3);
number = value.slice(3);
break;

case 11: // +CPPP####### -> CCC (PP) ###-####
country = value[0];
city = value.slice(1, 4);
number = value.slice(4);
break;

case 12: // +CCCPP####### -> CCC (PP) ###-####
country = value.slice(0, 3);
city = value.slice(3, 5);
number = value.slice(5);
break;

default:
return tel;
}

if (country == 1) {
country = “”;
}

number = number.slice(0, 3) + ‘-‘ + number.slice(3);

return (country + ” (” + city + “) ” + number).trim();
};
});

———————————————————————

HTML

<div ng-app>

<div ng-controller=”Ctrl”>

<label>Enter a telephone number to format:</label>
<input ng-model=”phoneNumber” ng-bind=”phoneNumber | tel” /><br><br>
Result formatted: {{ phoneNumber | tel }}
</div>
</div>

——————————————————————-

http://jsfiddle.net/rahuladmin/0ff1v2kr/

Categories: AngularJs

AngularJS – Programmatic access for select dropdown


Set value of select dropdown in AngularJS

http://jsfiddle.net/rahuladmin/khnfvrpq/