Pass data with ng-click - angularjs

I have the following contentString for a infowindow for google maps. I'm having a hard time figuring out something I'm sure its simple, but I cant seem to be able to send data with my clickTest function. In this case I want to send the data for location.
var contentString =
"<div>" +
"<a ng-click=clickTest()>" + location.activityNumber + "</a>" +
"<br><a>" + location.customer + "</a>" +
"<br><a>" + location.orderClass + "</a>" +
"<br><a>" + location.accountNumber + "</a>" +
"<br><a>" + location.date + "</a>" +
"<br><a>" + location.serviceRegion + "</a>" +
"<br><a>" + location.techid + "</a>" +
"<br><a>" + location.phoneNumber + "</a>" +
"<br><a>" + location.address + "</a>" +
"<br><a>" + location.city + ', ' + location.state + ', ' + location.zip + "</a>" +
"</div>";
Thanks in advance

Related

Klarna checkout - using React & Node

I'm trying to implement Klarna checkout to accept payments.
When creating an order (first step of the checkout) you receive a "html_snippet" as response from Klarnas API (in my case to express backend). It requires that this snippet is shown in the front end (in my case react).
Having read Klarnas documentation, I still cant figure out how to show this html snippet in react. Even copy pasting the exact snippet gives me 41 error warnings.
The snippet looks like this:
html_snippet: '<div id="klarna-checkout-container" style="overflow: hidden;">\n' +
' <div id="klarna-unsupported-page">\n' +
' <style type="text/css">\n' +
' #-webkit-keyframes klarnaFadeIn{from{opacity:0}to{opacity:1}}#-moz-keyframes klarnaFadeIn{from{opacity:0}to{opacity:1}}#keyframes klarnaFadeIn{from{opacity:0}to{opacity:1}}#klarna-unsupported-page{opacity:0;opacity:1\\9;-webkit-animation:klarnaFadeIn ease-in 1;-moz-animation:klarnaFadeIn ease-in 1;animation:klarnaFadeIn ease-in 1;-webkit-animation-fill-mode:forwards;-moz-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-duration:.1s;-moz-animation-duration:.1s;animation-duration:.1s;-webkit-animation-delay:5s;-moz-animation-delay:5s;animation-delay:5s;text-align:center;padding-top:64px}#klarna-unsupported-page .heading{font-family: "Klarna Headline", Helvetica, Arial, sans-serif;color: rgb(23, 23, 23);font-size: 36px;letter-spacing: -0.2px;-webkit-font-smoothing: antialiased;}#klarna-unsupported-page .subheading{font-family: "Klarna Text", "Klarna Sans", Helvetica, Arial, sans-serif;color: rgb(23, 23, 23);-webkit-font-smoothing: antialiased;line-height: 28px;font-weight: 400;font-size: 19px;max-width: 640px;margin: 20px auto;}#klarna-unsupported-page .reload {cursor: pointer;outline: none;-webkit-tap-highlight-color: rgba(255, 255, 255, 0);border-width: 1px;background-color: rgb(38, 37, 37);border-color: rgb(38, 37, 37);padding: 15px 24px;margin-top: 15px;color: rgb(255, 255, 255);font-family: "Klarna Text", "Klarna Sans", Helvetica, Arial, sans-serif;font-weight: 500;text-rendering: geometricprecision;font-size: 100%;}\n' +
' </style>\n' +
' <h1 class="heading">Something went wrong</h1>\n' +
' <p class="subheading">Sorry for any inconvenience, please try reloading the checkout page or try again later.</p>\n' +
' <p class="subheading">If the problem persists it maybe be because you are using an old version of the web browser which is not safe nor compatible with modern web sites. For a smoother checkout experience, please install a newer browser.</p>\n' +
' <button class="reload" onclick="reloadCheckoutHandler && reloadCheckoutHandler()">Reload checkout</button>\n' +
' </div>\n' +
' <script id="klarna-checkout-context" type="text/javascript">\n' +
' /* <![CDATA[ */\n' +
' var reloadCheckoutHandler;\n' +
' (function(w,k,i,d,n,c,l){\n' +
' w[k]=w[k]||function(){(w[k].q=w[k].q||[]).push(arguments)};\n' +
' l=w[k].config={\n' +
' container:w.document.getElementById(i),\n' +
" ORDER_URL:'https://js.playground.klarna.com/eu/kco/checkout/orders/dae844ba-c44a-6e55-b5ad-9afe9055e1f4',\n" +
" AUTH_HEADER:'KlarnaCheckout 4mpla37op0i19pv6g054',\n" +
" LOCALE:'en-GB',\n" +
" ORDER_STATUS:'checkout_incomplete',\n" +
" MERCHANT_NAME:'Your business name',\n" +
' GUI_OPTIONS:[],\n' +
' ALLOW_SEPARATE_SHIPPING_ADDRESS:false,\n' +
" PURCHASE_COUNTRY:'gbr',\n" +
" PURCHASE_CURRENCY:'GBP',\n" +
' TESTDRIVE:true,\n' +
" BOOTSTRAP_SRC:'https://js.playground.klarna.com/kcoc/220119-c2c224d/checkout.bootstrap.js',\n" +
" FE_EVENTS_DISABLED:'false',\n" +
" DEVICE_RECOGNITION_URL:'https://js.playground.klarna.com/eu/kco/checkout/orders/dae844ba-c44a-6e55-b5ad-9afe9055e1f4/device_recognition',\n" +
' DEVICE_RECOGNITION_TYPE1:true,\n' +
" DEVICE_RECOGNITION_TYPE3_ORG_ID:'87rxrdob',\n" +
" DEVICE_RECOGNITION_TYPE3_REF:'KLRNA_87rxrdob_dae844ba-c44a-6e55-b5ad-9afe9055e1f4',\n" +
" CLIENT_EVENT_HOST:'https://eu.playground.klarnaevt.com'\n" +
' };\n' +
" n=d.createElement('script');\n" +
' c=d.getElementById(i);\n' +
' n.async=!0;\n' +
' n.src=l.BOOTSTRAP_SRC;\n' +
' c.appendChild(n);\n' +
' try{\n' +
" ((w.Image && (new w.Image))||(d.createElement && d.createElement('img'))||{}).src =\n" +
" l.CLIENT_EVENT_HOST + '/v1/checkout/snippet/load' +\n" +
" '?sid=' + l.ORDER_URL.split('/').slice(-1) +\n" +
" '&order_status=' + w.encodeURIComponent(l.ORDER_STATUS) +\n" +
" '&timestamp=' + (new Date).getTime();\n" +
' }catch(e){}\n' +
' reloadCheckoutHandler = function () {\n' +
' try{\n' +
" ((w.Image && (new w.Image))||(d.createElement && d.createElement('img'))||{}).src =\n" +
" l.CLIENT_EVENT_HOST+'/v1/checkout/snippet/reload?sid='+l.ORDER_URL.split('/').slice(-1)+\n" +
" '&order_status='+w.encodeURIComponent(l.ORDER_STATUS)+'&timestamp='+(new Date()).getTime();\n" +
' window.location.reload();\n' +
' }catch(e){}\n' +
' }\n' +
" })(this,'_klarnaCheckout','klarna-checkout-container',document);\n" +
' /* ]]> */\n' +
' </script>\n' +
' <noscript>\n' +
'Please enable JavaScript.\n' +
' </noscript>\n' +
'</div>'
Anyone been through this journey?
You may have already solved this, but I used Iframe to render the snippet. Make an HTML page with the received snippet inside and use that as the source for your Iframe.
<iframe
title='klarnaCheckout'
className='iframe'
srcDoc={klarnaHtml(klarna.html_snippet)}
frameBorder='0'
></iframe>
export const klarnaHtml = (snippet) => {
return `
<html>
<head> </head>
<body>
<textarea style="display: none" id="KCO">
${snippet}
</textarea
>
<div id="my-checkout-container"></div>
<!-- START - Dont edit -->
<script type="text/javascript">
var checkoutContainer = document.getElementById(
"my-checkout-container"
);
checkoutContainer.innerHTML = document
.getElementById("KCO")
.value.replace(/\\"/g, '"')
.replace(/\\n/g, "");
var scriptsTags = checkoutContainer.getElementsByTagName("script");
for (var i = 0; i < scriptsTags.length; i++) {
var parentNode = scriptsTags[i].parentNode;
var newScriptTag = document.createElement("script");
newScriptTag.type = "text/javascript";
newScriptTag.text = scriptsTags[i].text;
parentNode.removeChild(scriptsTags[i]);
parentNode.appendChild(newScriptTag);
}
</script>
<!-- END -->
</body>
</html>
`;
};

fnDrawCallback how to loop through each row

How do i loop through the enitre datset within the in datatables method?
"fnFooterCallback": function (nFoot, aData, iStart, iEnd, aiDisplay) {
$(aData).each(function (index) {
$(".it").append("<div class='mapdata' id='" + nFoot + "B' title='" + aData[index][14] + "|" + aData[index][15] + "' >");
});
},
The above works if the pagination is removed. But if iDisplayLength is set to 25 for example then it only goes through 25 records, not all 100 etc.
"fnFooterCallback": function (nFoot, aData, iStart, iEnd, aiDisplay) {
$(aData).each(function (index) {
$(".it").append("<div class='mapdata' id='" + nFoot + "B' title='" + aData[index][14] + "|" + aData[index][15] + "' data-id='true' data-id2='" + aData[index][1] + "' data-isapprove='" + aData[index][12] + "' ><div class='gTab1'><div class='info'><div class='maptitle'>" + aData[index][1] + "</div><div class='location'></div></div></div ></div >");
});
},
The above did it

Angular-translate filter inside ng-style

is it possible to use the angular-translate (pascaltrend) plugin within an ng-style in AngularJS:
I have:
<div class="inspiration-wrapper" ng-style="{'background-image': 'url(//' + S3_BUCKET + '.' + PHOTO_SERVER_URL + '/img/departures/' + departurePhoto + ')'}">
and I need something like:
<div class="inspiration-wrapper" ng-style="{'background-image': 'url(//' + S3_BUCKET + '.' + PHOTO_SERVER_URL + '/img/departures/' + departurePhoto | translate + ')'}">
this should work
<div class="inspiration-wrapper" ng-style="{'background-image': 'url({{'/' + S3_BUCKET + '.' + PHOTO_SERVER_URL + '/img/departures/'}}{{'departurePhoto' | translate }})'}"></div>
I'm asuming you have this as variable in scope
S3_BUCKET and PHOTO_SERVER_URL

How can I get the initial value of a comboBox?

I need get the initial value of a comboBox to charge a tooltip on my application, i got this method but this not charge nothing
var raw = ComboRegisted.combo.getRawValue();
Ext.QuickTips.register({ target: ComboRegisted.combo.getEl(), text: COREProxy.languageMng.getText(oThis.CLASS_NAME, "tooltipNormativaFechaAprobacion") + raw.fechaAprobacion +
"<br/>" + COREProxy.languageMng.getText(oThis.CLASS_NAME, "tooltipNormativaCO") + raw.normaCO + COREProxy.languageMng.getText(oThis.CLASS_NAME, "tooltipNormativaUnidad1") +
"<br/>" + COREProxy.languageMng.getText(oThis.CLASS_NAME, "tooltipNormativaHC") + raw.normaHC + COREProxy.languageMng.getText(oThis.CLASS_NAME, "tooltipNormativaUnidad1") +
"<br/>" + COREProxy.languageMng.getText(oThis.CLASS_NAME, "tooltipNormativaNox") + raw.normaNox + COREProxy.languageMng.getText(oThis.CLASS_NAME, "tooltipNormativaUnidad1") +
"<br/>" + COREProxy.languageMng.getText(oThis.CLASS_NAME, "tooltipNormativaPM") + raw.normaPM + COREProxy.languageMng.getText(oThis.CLASS_NAME, "tooltipNormativaUnidad1") +
"<br/>" + COREProxy.languageMng.getText(oThis.CLASS_NAME, "tooltipNormativaHumo") + raw.normaHumo + COREProxy.languageMng.getText(oThis.CLASS_NAME, "tooltipNormativaUnidad2" )});
this.comboMap.register(ComboRegisted.ID, ComboRegisted.meta, ComboRegisted.combo);
No problem i get the answer now.
I do this:
var recordSelected = ComboRegisted.combo.store.getAt(ComboRegisted.combo.getValue());
var raw = recordSelected.raw;
and this go good.

Can anybody to solve gauss looping error?

I am unable to solve the problem.
vd1 = ir1.^2;
vd2 = ir1.^2 + ir2.^2;
vd2 = 100*vd2./sumc(vd2');
vd3 = ir1.^2 + ir2.^2 + ir3.^2;
vd3 = 100*vd3./sumc(vd3');
vd4 = ir1.^2 + ir2.^2 + ir3.^2 + ir4.^2;
vd4 = 100*vd4./sumc(vd4');
vd5 = ir1.^2 + ir2.^2 + ir3.^2 + ir4.^2 + ir5.^2;
vd5 = 100*vd5./sumc(vd5');
vd6 = ir1.^2 + ir2.^2 + ir3.^2 + ir4.^2 + ir5.^2 + ir6.^2;
vd6 = 100*vd6./sumc(vd6');
vd7 = ir1.^2 + ir2.^2 + ir3.^2 + ir4.^2 + ir5.^2 + ir6.^2 + ir7.^2;
vd7 = 100*vd7./sumc(vd7');
vd8 = ir1.^2 + ir2.^2 + ir3.^2 + ir4.^2 + ir5.^2 + ir6.^2 + ir7.^2 + ir8.^2;
vd8 = 100*vd8./sumc(vd8');
vd9 = ir1.^2 + ir2.^2 + ir3.^2 + ir4.^2 + ir5.^2 + ir6.^2 + ir7.^2 + ir8.^2 + ir9.^2;
vd9 = 100*vd9./sumc(vd9');
vd10 = ir1.^2 + ir2.^2 + ir3.^2 + ir4.^2 + ir5.^2 + ir6.^2 + ir7.^2 + ir8.^2 + ir9.^2 + ir10.^2;
vd10 = 100*vd10./sumc(vd10');
and I want to sum up vd1 to vd10.
so I use the loop.
tr=0;
i=1;
do intil i>10;
tr = tr + vd[i];
i=i+1;
endo;
but error occur.
How I can handel this?
please help me...
You should write:
do until i >= 10;
Remark : if you want to sum up vd1 to vd10, it seems that you should use the >= operator.

Resources