I have an angular app in which there's a table that includes something of the general form:
<tr ng-repeat='d in data'>
<td>{{d.foo}}</td>
</tr>
I'd like to use the value of d.foo (which, for example, could be Bicycle to turn the cell into a link to a website like http://en.wikipedia.org/wiki/Bicycle. I've tried to find an answer to this on SO already but have had no luck; my apologie if I just didn't see it.
Is it possible to do the described task? If so, any pointers or suggestions?
Use:
<td><a ng-href="http://en.wikipedia.org/wiki/{{d.foo}}">{{d.foo}}</a></td>
You can read more here: http://docs.angularjs.org/api/ng.directive:ngHref
;)
Use it in a <a> tag.
For example:
{{d.foo}}
Related
I am making a report template that is required for my school project. Inside the report, I need to display all the cars and their respective details. As you can see from the code below, I am using spring expression language to perform loop on return data and it works as intended.
<div>
<table>
<tbody>
$foreach{car: entity.cars}
<tr>
<td>${car.name}</td>
<td>${car.color}</td>
<td>${car.model}</td>
</tr>
$end{}
</tbody>
</table>
</div>
However, when I switch between Source and WYSISYG, the whole expression will be omitted from the table element and become like this:
<div> $foreach{car: entity.cars} $end{}
<table>
<tbody>
<tr>
<td>${car.name}</td>
<td>${car.color}</td>
<td>${car.model}</td>
</tr>
</tbody>
</table>
</div>
I have read the documentation from CKEditor and found out there's a feature called 'ACF'. It helps us to discards invalid, useless HTML tags and attributes so the editor remains "clean" during runtime.
I already tried
config.allowedContent = true;
I am not particularly sure whether my problem is caused by the 'ACF' feature. If it does, how can I configure it so that the editor will ignore the expression and leave it as it is?
EDIT
I tested the code above with another rich text editor (RTE) out there. Unfortunately, it turns out all of them return the same result. I believe it is illegal to put such an expression between the table elements in an RTE. How should I modify my code so that it is syntactically correct in an RTE?
I just got a workaround for this issue. I noticed the editor will not remove SPEL if I specifically tell it not to do so in the 'config.js' file.
You can achieve this by configuring protectedSource. For more details, please check this link:
https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-protectedSource
I have a folder full of .html files. I wish to edit all of these files. I wish to edit them as below. Here is my original code :
<td class="class1" align="left" valign="top" height="100%" width="100%">Text to edit</td>
I wish to replace all occurrences with:
<td class="class1" align="left" valign="top" height="100%" width="100%"><h2>Text to edit</h2></td>
Notice the added h2 tags.
What's the best and easiest program/method I can use to apply these rules to an entire folder in Windows 7? BeautifulSoup? Is there a easy way to do this? What programs/APIs would you recommend for similar work?
Thanks.
I would rather do it using regular expressions.
Just write an script in your favourite scripting language that opens sequentally all those files and use something like PHP preg_replace method.
XPath is also an option as recommended by Jerome but I believe that it is kind of "overkill" for such a simple need.
If you consider html as xml you can accomplish this with the use of xpath.
Hope you guys can help me out, i can't find any tutorials online regarding this.
How can you use a
<bean:write....>
inside a
<html:form....>
My code is like:
<html:form action="/restricted/client/social/NewsFeedAction.do?action=REPLY&id=<bean:write name='adminFeed' property='id'/>">
then when i check the id value through debugging its just
<bean:write name='adminFeed' property='id'/>
instead of the ID value like 555 or so...
I can confirm that this bean write tag works as can use that within a
<a href...>
tag no problem.
Any ideas?
Thanks!
You cannot use tag inside another tag.
I use small workaround.
<bean:define id="myId" name='adminFeed' property='id'/>
<html:form action="/restricted/client/social/NewsFeedAction.do?action=REPLY&id=${myId}">
Is it possible to export for example table, or ul tags with all children elements to pdf file? (COULD WE USE ONLY FREE OF CHARGE LIBRARIES?)
For example I have the table.
<table>
<tr>
<td class="my-style">
</td>
</tr>
</table>
Is it possible to export this table to pdf with style. I.e. "my-style" has red color.
Thanks in advance :)
We use PDF Sharp and Migradoc to generate PDF files on the fly. Migradoc has good layout and page break controls.
It has table layouts that are pretty easy to understand for most developers.
http://www.pdfsharp.net
You can use iTextSharp lib, this has the ability to decorate display text as you like.
Check this link:
http://www.codeproject.com/KB/graphics/iTextSharpTutorial.aspx
Sergey,
everyone will have their favourite. however, one that I really like and use literally daily, is the http://www.evopdf.com/. allows you to use your existing asp.net views, so really is a no brainer.
I need to find a <div> with certain content and click it from Selenium, as so:
<tr>
<td>clickAndWait</td>
<td>//div[#class='gwt-Label' ***WITH CONTENT='Logout'***]</td>
<td>5000</td>
</tr>
Is there some way to do this? I don't want to use an absolute xpath.
You could also use CSS locators:
<div class="gwt-Label">This FindMe DIV</div>
Could be located using:
css=.gwt-Label:contains('FindMe')
try this:
//div[#class='gwt-Label' and contains(., 'Logout')]
Perhaps your XPath just isn't quite doing what you think. You may need to use the string() function to concatenate all the text in a block.
For example, in TestPlan (using Selenium as backend) you would do something like this:
Click //div[#class='gwt-Label'][contains(string(),'Logout')]
Note the use of string()