I am trying to append li element using jquery.the "li" element is appended successfully howerver ng-click event is not working. please help.
below is my code.
$(".language-list").append("<li><span ng-click='selectOperator(op)'><label for=checkbox" + $scope.allOperators[op].operator_id + " class=labeloperator" + ">" + $scope.allOperators[op].operator_name + "</label></div></span></li>");
On append you need compile the element.
It not good practice to do that in controller. Use directive for any DOM selection/manipulation.
Anyways here is example:
var elmnt = angular.element(/* ... */);
elmnt.append(
$compile(
"<li><span ng-click='selectOperator(op)'><label for=checkbox" + $scope.allOperators[op].operator_id + " class=labeloperator" + ">" + $scope.allOperators[op].operator_name + "</label></div></span></li>"
)($scope));
You must compile the dynamic HTML to do the work.
$(".language-list")
.append(
$compile(
"<li><span ng-click='selectOperator(op)'><label for=checkbox" +
$scope.allOperators[op].operator_id + " class=labeloperator" + ">" +
$scope.allOperators[op].operator_name + "</label></div></span></li>")
)($scope);
For more Information about $compile service
Related
I want to create scenario where i want use data from jar file into Jmeter Loop logic.
My jar looks like:
public String Australia()
{
String a = "{"
+ "\"location\": {"
+ "\"lat\": -33.8669710,"
+ "\"lng\": 151.1958750"
+ "},"
+ "\"accuracy\": 50,"
+ "\"name\": \"Google Shoes!\","
+ "\"phone_number\": \"(02) 9374 4000\","
+ "\"address\": \"48 Pirrama Road, Pyrmont, NSW 2009, Australia\","
+ "\"types\": [\"shoe_store\"],"
+ "\"website\": \"http://www.google.com.au/\","
+ "\"language\": \"en-AU\""
+
"}";
return a;
}
public String canada()
{
String c = "{"
+ "\"location\": {"
+ "\"lat\": -33.8669710,"
+ "\"lng\": 151.1958750"
+ "},"
+ "\"accuracy\": 50,"
+ "\"name\": \"Google Shoes!\","
+ "\"phone_number\": \"(02) 9374 4000\","
+ "\"address\": \"48 Pirrama Road, Pyrmont, NSW 2009, Canada\","
+ "\"types\": [\"shoe_store\"],"
+ "\"website\": \"http://www.google.com.ca/\","
+ "\"language\": \"en-CA\""
+
"}";
return c;
}
1) with above data i want to 'feed' Jmeter call as described on the bellow picture
2) every time i add new country at the jar file, loop be increased accordingly.
Some thought how this could be done, what should i use as variable and how i can tell the loop to increase?
Add JSR223 PreProcessor as a child of the 002_2_send payment request
Put the following code into "Script" area:
def testData = new com.example.TestData()
def methods = testData.class.getDeclaredMethods()
def payload = org.apache.commons.lang.reflect.MethodUtils.invokeExactMethod(testData, methods[vars.get('__jm__Loop Controller__idx') as int].getName())
sampler.addNonEncodedArgument('',payload,'')
sampler.setPostBodyRaw(true)
Define "Loop Count" in the Loop Controller using __groovy() function like:
${__groovy(com.example.TestData.getDeclaredMethods().size(),)}
Change com.example to your own package name and TestData to your class name
Once you drop the new version of .jar to JMeter Classpath you will need to restart JMeter to pick up the changes
That's it, each iteration of the Loop Controller the JSR223 PreProcessor will execute the next function in your class and update the request body with the returned data:
References:
Java Reflection API
Apache Groovy - Why and How You Should Use It
I need to add a margin to an element with some calculations as below:
[ngStyle]="{'margin-left': calc(sustainScrore && sustainScrore.scoring && sustainScrore.scoring.score ? sustainScrore.scoring.score + '%' : '0%')}"
This seems to throw an error :
ERROR TypeError: _co.calc is not a function Looking for a solution.
[ngStyle]="{ 'margin-left': 'calc(' + (sustainScrore?.scoring?.score || '0') + '%)' }"
This should do the trick.
Your issue was not considering calc as a string : Angular was looking for a funtion to call, while you wanted to create a CSS property. I also reduced your code with the safe navigation operator, leaving you with cleaner code.
if you want to reduce it further, use the style.XXX notation :
[style.margin-left]="'calc(' + (sustainScrore?.scoring?.score || '0') + '%)'"
when i alert the array, he return the hole value, but when i try to get it from getElementById, he stop after the first space!??
I know, it's probably simple, but i dont understand the difference between the 2 answers
https://jsfiddle.net/prodeinfo/jvywho3y/
html
<div>
<div id="statusList"></div>
</div>
javascript
var countryLan = ["nothing","Also nothing",];;
alert(countryLan[1]);
document.getElementById('statusList').innerHTML += "<input type='text' value=" + countryLan[1] + " />";
Try this:
document.getElementById('statusList').innerHTML += "<input type='text' value='" + countryLan[1] + "' />";
as you can see, I added ' in value: value='" + countryLan[1] + "' />"
You had a problem because if you want to pass a text that contains spaces, you need to quote this text properly.
In your case, you just put the value from an array as is, without quotes and that's why there was only "Also" in your input.
Now it should work.
Good luck.
I have created a customized work order submission form in Forms & Sheets that auto emails a confirmation from each submission (job request form) to create a data trail of vendor activity. Fairly integrated and totally cobbled together by a lot of reading in these forums coupled with a gazillion frustrating moments of trial & error. Novice moving towards "capable" but Im stuck on a piece of code for a triggered confirmation email with random work order generator and email confirmations and toggle based management built in. The code below that I actually need help with is for that triggered confirmation email that sends a confirmation of service, work order #, and also shows everything they originally submitted. The problem is that the code I have is providing the data exactly how and I want it and placement is great, but I need to create visual distinction between the column titles and the variable submission data. Can someone please help me add a bold code to the column titles in line 16 to help create that visual differentiation between columnar "category and submission data?
// This constant is written in column C for rows for which an email
// has been sent successfully.
var EMAIL_SENT = "EMAIL_SENT";
function sendEmails2() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2; // First row of data to process
var numRows = 1000; // Number of rows to process
// Fetch the range of cells A2:B3
var dataRange = sheet.getRange(startRow, 1, numRows, 27)
// Fetch values for each row in the Range.
var data = dataRange.getValues();
for (var i = 0; i < data.length; ++i) {
var row = data[i];
var emailAddress = row[19];
var message = row[16] + "\n\n" + "Submitted By: " + row[19] + "\n\n" + "Date Submitted: " + row[0] + "\n\n" + row[21] + "\n\n" + "IMPORTANT NOTES FROM CDS: " + row[20] + "\n\n" + "Full Show Services: " + row[3] + "\n\n" + "Event Start Date: " + row[4] + "\n\n" + "Event End Date: " + row[5] + "\n\n" + "Warehouse Locations: " + row[6] + "\n\n" + "Individual Services Requested: " + row[7] + "\n\n" + "Individual Services - Warehouse(s) & Date(s) Requested: " + row[8] + "\n\n" + "Partial Hourly Staffing Details Requested: " + row[9] + "\n\n" + "Requestors Instructions / Comments: " + row[10] + "\n\n" + "Files: " + row[11] + row[12] + "\n\n" + "Thank you for your request. We appreciate your business. CDS Special Events Team ";// Second columnn
var emailSent = row[18];
var subject = row[16];// Third columnvar ss = SpreadsheetApp.getActiveSpreadsheet();
if (emailSent != EMAIL_SENT) { // Prevents sending duplicates
MailApp.sendEmail(emailAddress, subject, message);
sheet.getRange(startRow + i, 19).setValue(EMAIL_SENT);
// Make sure the cell is updated right away in case the script is interrupted
SpreadsheetApp.flush();
}
}
}
52 Low
This is how the html part is coded by developer
In case the ID of the link (tab) is not changing then you should put:
((JavascriptExecutor)driver).executeScript("document.getElementById('tab8').click()");
or even simplier (as Vivek noted):
((JavascriptExecutor)driver).findElement(By.id('tab8')).click();
In case the ID of the tab could potentially change you could search it by its text:
((JavascriptExecutor)driver).executeScript(
"var tabs= document.getElementsByTagName("a");" +
"var tabText= "52 Low";" +
"for (var i = 0; i < tabs.length; i++) {" +
" if (tabs[i].textContent == tabText) {" +
" tabs[i].click();" +
" break;" +
" }" +
"}");