In one of the pages of my app, I am using ng-bind-html to show some text through a function:
<ng-bind-html
ng-bind-html="getText(textContainer)">
</ng-bind-html>
getText() returns some text which is html code + some angularjs, something like:
<table>
<tbody>
<tr>
<td>
SOME TEXT
<textarea data-ng-bind-html="getOtherText(index)" data-ng-keyup="updateOtherText(index)</textarea>
</td>
</tr>
</tbody>
</table>
Now, I don't know if this is feasible (I am aware that it could be not particular good), but the second bind and the keyup don't seem to fire. Could someone explain me why please?
Related
I've got a nested ng-repeat that displays a seemingly random list of the possible ones I get.
My HTML is like this:
<table ng-init="getHouses()">
<tr>
<td>Id</td>
<td>Name</td>
</tr>
<tr ng-repeat="h in houses>
<td>{{h.Id}}</td>
<td>{{h.Name}}</td>
<td ng-init="peopleInhHouse(h.Id)">
<span ng-repeat="p in peopleInHouse">p.Name</span>
<br />
</td>
</tr>
I think the problem lies here because I get my lists of people correctly, the problem being that it displays the same list of people for all the different houses and it seems to randomize between everytime I refresh the page.
Your variable peopleInHouse will always reference to the same value. And since you are using a request to get data you can't simply use it directly in the ng-repeat
So just update the ng-init function so it populates the people in the house
The function should look something like
function addPeopleToHouse(house){
request(house.id).then(function(response){
house.People = response.data;
})
}
And update the HTML to
<td ng-init="addPeopleToHouse(h)">
<span ng-repeat="p in h.People">p.Name</span>
<br />
</td>
I got a plug-in in Wordpress, where i have a shortcode [foobar] which outputs a form.
If i put the shortcode [foobar] inside a page in wordpress, the output shows as it should, e.g.:
<form>
<input></input>
</form>
If i put the shortcode inside a table like so:
<table>
<tr>
<td> [foobar] </td>
</tr>
</table>
Then the output is as two elements:
<form>
<input></input>
</form>
<table>
<tr>
<td> </td>
</tr>
</table>
The table is empty, and the output is displayed before the table, even though the shortcode is placed within the td element.
I tried putting the shortcode within a <div> tag, but same result - the shortcode is displayed before the <div> tag, and the <div></div> turns out empty.
I have no idea why this happens, maybe it is some kind of error within wordpress?
If any further information is needed, please let me know. I will gladly post the code, however i am not sure it has any relevance.
If you're going to execute a shortcode in your php page you have to do it with php as so:
<td><?php echo do_shortcode('[foobar]'); ?></td>
Give that a shot.
If you're doing this from the WP dashboard... it's because the shortcode itself has styles applied to it that will need to be adjusted to fit where you want to place it.
Do an inspect element on the shortcode as it prints on the page and see the styles that are associated with the shortcode and override or otherwise adjust them in your CSS.
Hello I have a simple HTML table with several rows. I want to alert the user with a message when they click on a particular row. Here is what I tried to get this to work...
<tr onClick="alert(some Message)">
<td>${o.hospitalId}</td>
<td>${o.name}</td>
<td>${o.address}</td>
</tr>
However, that is not working. Am I missing some HTML basics here?
seems to be ok, but try:
<tr onclick="javascript:alert('something');">
or try jquery:
$("tr").click(function () { alert("something"); });
Code seems to be good, of course if you want display literary 'some Message' text it must be between ' and ', like in lante's example. If it won't work still, you can have javascript disabled in browser settings.
add these 'some message' and then it will work fine
<tr onClick="alert('some Message')">
<td>${o.hospitalId}</td>
<td>${o.name}</td>
<td>${o.address}</td>
</tr>
Some Message should be single quotes ' text ' reason behind your alert not working
<table>
<tr>
<td onclick="alert('You are clicking on the cell EXAMPLE')"> Data </td>
</tr>
</table>
I have a problem when using UI tags (ex: <s:select />) in Struts.
I use the default theme in a form (theme='xhtml')
CASE 1
When using
<s:select label="FIELD1" ....../>
Struts2 will generate the HTML code shown below (I skipped the non-important portions)
<table>
<tr>
<td>FIELD1:</td>
<td> <select ...... > </td>
</tr>
</table>
CASE2
When using
<s:select label='' .....>
the generated HTML code is shown below:
<table>
<tr>
<td>:</td>
<td> <select ...... > </td>
</tr>
</table>
In the HTML code generated by Struts2, you still see a colon in the label field in table.
CASE3
When using
<s:select .....>
If I do not use a label attribute, Struts2 will generate the HTML code shown below:
<table>
<tr>
<td></td>
<td> <select ...... > </td>
</tr>
</table>
In the HTML code generated by Struts2, you will see the label text is completely empty.
What I wish is, I set the attribute label='', and the label text in the HTML code generated by Struts2 is empty (no colon).
How do I do this?
Use the labelSeparator attribute to empty string and your requirement would be satisfied. Please refer the document for other attribute references for <s:select>:
http://struts.apache.org/2.x/docs/select.html
This is due to the xhtml theme which you are using and based on that Struts2 tags are generating the HTML output for you.
here is what happening inside Struts2 free marker template which is being used to generate the HTML output.
${parameters.labelseparator?default(":")?html}<#t/>
so what happening when you have no labelseparator it is using default seperator which Struts2 internally using :
So either you should provide labelSeparator as said by James and for better control of the output use simple theme and defined/design page as per your choice.
Is there a way to grab things out of the source code of another site directly into your site?
For example, let's say than in a site the following source code exists:
<table ...>
<tr>
<td class=...>...</div></td>
</tr>
<tr>
<td class=....><div align="... class=...>"Interesting string that keeps changing"</div></td>
</tr>
</table>
And we want that Interesting string that keeps changing to appear in our website as well.
you could use php
you use
$html = file_get_contents('url to website');
or use a hidden if you want a javascript function, and then just grab the innerhtml