Declare below variables in class
highlightClass = "highlightText";
highlightRe: any;
spaceRe = /\s+/;
spaceRe2 = /\s+$/;
before: any = "";
after: any = "";
My Blog contain Phonegap,CMS related posts. Here I am posting the issues solution that I faced while development and its difficult to find proper solution on other sites. I hope my post will help you with your issues. Developer rocks.
app.controller('One', ['$scope', '$rootScope'
function($scope) {
$rootScope.$on("CallParentMethod", function(){
$scope.parentmethod();
});
$scope.parentmethod = function() {
// task
}
}
]);
app.controller('two', ['$scope', '$rootScope'
function($scope) {
$scope.childmethod = function() {
$rootScope.$emit("CallParentMethod", {});
}
}
]);
While $rootScope.$emit is called, you can send any data as second parameter.
Solution for IONIC2+ will be up soon.Initialization of the variable to store all logs incontroller
$rootScope. = {}; timeSlots
//Function to createwith object eventname start time, end time using , ID
$scope.logEvent = function(Eventid, EventName, isEnd){if ( isEnd == false) { $rootScope. timeSlots [ Eventid] = { "name ":EventName , "startDate ": new Date( ). getTime ( ) }; }else { $rootScope. timeSlots [ Eventid] ["endDate "] = new Date( ). getTime ( ); } };Log starting time$scope. "function1" logEvent ( , "Function1 start Time", false);
ngSrc directive serves to properly set an image src via Angular. As anything in Angular, it updates the image as soon as the contained Angular expression changes. However, when the ng -src attribute is empty, Angular will not empty the src attribute. To overcome this, use the trick below.
<img ng-src="{{ element.image || '//:0' }}" />
ngSrc directive explicitly returns when the attribute value is false. As a workaround, set a "blank" image //: 0 serves this purpose: It adopts the current protocol, omits the hostname and sets the port to zero, which is invalid and should be killed by the network layer.src attribute when ng -src empties.var arry1 = [3,4,6,9,9,9];
var arry2 = [9,8,9,8,5];
$("#arry1").html(arry1.toString());
$("#arry2").html(arry2.toString());
var directResult = arry1.join('') * arry2.join(''); // to compare result
$("#result").html(directResult);
var calResult = [];
var vadi=0;
for(var i=0;i<arry2.length;i++){
calResult[i]=[];
vadi = 0;
for(var j=arry1.length-1;j>=0;j--){
var temp= arry1[j]*arry2[i]+vadi;
if(temp.toString().length > 1){
vadi = parseInt(temp.toString().substr(0, 1));
temp = parseInt(temp.toString().substr(1, 1));
} else{
vadi = 0;
}
calResult[i].unshift(temp);
}
for(var k=i+1;k<arry2.length;k++){
calResult[i].push(0);
}
if(vadi!=0){
calResult[i].unshift(vadi);
vadi = 0;
}
if(calResult[i].length != calResult[0].length){
var lengthDiff = calResult[0].length-calResult[i].length;
for(var p=0;p<lengthDiff;p++){
calResult[i].unshift(vadi);
}
}
}
var finalResult = [];
var finalvadi = 0;
for(var m =calResult[0].length-1;m>=0;m--){
var tempr = 0;
for(var n=0; n<calResult.length;n++){
tempr+=calResult[n][m];
}
tempr+=finalvadi;
finalvadi=0;
if(tempr.toString().length > 1){
finalvadi = parseInt(tempr.toString().substr(0, 1));
tempr = parseInt(tempr.toString().substr(1, 1));
} else{
finalvadi = 0;
}
finalResult.unshift(tempr);
}
if(finalvadi!=0){
finalResult.unshift(finalvadi);
}
$("#finalResult").html(finalResult.toString());
<div id="arry1"></div>
<div id="arry2"></div>
<div>-----------</div>
<div id="result"></div>
<br/><br/>
<div>------------------</div>
<div id="finalResult" style=""></div>
<ion-view title="{{content.title}}">
<ion-view> <ion-nav-title>{{content.title}}</ion-nav-title>
@implementation NSURLRequest(DataController)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
{
return YES;
}
@end
try {
contact.birthday = new Date(parseFloat(value));
} catch (exception){
console.log("Cordova Contact toCordovaFormat error: exception creating date.");
}