This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<google-chart #googlechart | |
[title]="chart.title" | |
[type]="chart.type" | |
[data]="chart.data" | |
[options]="chart.options"> | |
</google-chart> | |
@ViewChild('googlechart') | |
googlechart: GoogleChartComponent; | |
chart = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div #chartTarget></div> | |
//component class | |
import { | |
Component, | |
ViewChild, | |
ElementRef, | |
AfterViewInit, | |
OnInit | |
} from '@angular/core'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function statusConverter(target: any, key: string) | |
{ | |
var value; | |
if (delete target[key]) { | |
Object.defineProperty(target, key, { | |
get: function() { | |
if (this.value) | |
{ | |
return 'Completed'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function propertyMap(sourceProperty:string) { | |
return function (target: any, propertyKey: string) { | |
if(!target.constructor._propertyMap){ | |
target.constructor._propertyMap ={}; | |
} | |
target.constructor._propertyMap[propertyKey] = sourceProperty; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ModelMapper<T> { | |
_propertyMapping: any; | |
_target: any; | |
constructor(type: { new(): T ;}){ | |
this._target = new type(); | |
this._propertyMapping = this._target.constructor._propertyMap; | |
} | |
map(source){ | |
Object.keys(this._target).forEach((key) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function getQueryParamsFromString (paramString: string) { | |
if (!paramString) { | |
return null | |
} | |
let paramsKeyValues = [] | |
let params = paramString.split('&') | |
for (let param of params) { | |
let separatorIndex = param.indexOf('=') | |
if (separatorIndex == -1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getQueryParamsFromString = (paramString) => (paramString | |
? splitString(paramString, '&') | |
.map(param => splitToPair(param, '=')) | |
: null | |
); | |
const splitString = (str, splitor) => str.split(splitor); | |
function splitToPair(paramString: string, separator: string) { | |
const [a, b = null] = splitString(paramString, separator); | |
return {key: a, value: b}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getQueryParamsFromString(paramString: string) { | |
if (!paramString) return null; | |
let paramsKeyValues = []; | |
const paramStrings = splitParams(paramString); | |
for (let param of paramStrings) { | |
paramsKeyValues.push(splitToPair(param, '=')); | |
} | |
return paramsKeyValues; | |
} | |
const splitParams = (str) => str.split('&'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getQueryParamsFromString(paramString: string) { | |
if (!paramString) return null; | |
const paramStrings = splitParams(paramString); | |
const paramsKeyValues = paramStrings.map(param => splitToPair(param, '=')); | |
return paramsKeyValues; | |
} | |
const splitParams = (str) => str.split('&'); | |
const indexOfSeparator = (str, separator) => str.indexOf(separator); | |
function splitToPair(paramString: string, separator: string) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = string.Format("https://api.push.apple.com/3/device/{0}", [deviceToken]); | |
var certData = System.IO.File.ReadAllBytes("xxx.p12"); | |
var certificate = new X509Certificate2(certData, "", X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable); | |
var topic = "xyz.com"; // App bundle Id | |
using (var httpHandler = new HttpClientHandler { SslProtocols = SslProtocols.Tls12 }) | |
{ | |
httpHandler.ClientCertificates.Add(certificate); | |
using (var httpClient = new HttpClient(httpHandler, true)) | |
using (var request = new HttpRequestMessage(HttpMethod.Post, url)) |