I'm trying to match
An error has occurred
in
<div id="someid" class="alert alert-warning">
<button type="button" class="close" data-dismiss="alert">×</button>
An error has occurred
</div>
I tried various combinations of id=someid and //div[#id='someid'] but it keeps matching the "x" in the element.
Related
Please find the below snippet. Can any one explain above functionality for the data-sly-test. How it will work condition here for image??
<div class="spon-image-container col-12 col-md-4">
<sly data-sly-test="${properties.fileReference}">
<img class="spon-_image" src="${properties.fileReference}"/>
</sly>
</div>
There are a few things to mention here. The gist of the code snippet is, that the <img> tag will only be rendered if {$properties.fileReference} is not empty.
Be aware, there is no sanity check involved here. data-sly-test won't check if the referenced file exists etc.
So assume that ${properties.fileReference} equals /content/dam/myImage.png. Then the resulting HTML would like this:
<div class="spon-image-container col-12 col-md-4">
<img class="spon-_image" src="/content/dam/myImage.png"/>
</div>
On the other hand, if the ${properties.fileReference} is empty (or null) you get the following HTML:
<div class="spon-image-container col-12 col-md-4">
</div>
Depending on your HTML/CSS/JS you might not want that to happen. So you could improve your code to include the data-sly-test statement in the <div> tag:
<div class="spon-image-container col-12 col-md-4" data-sly-test="${properties.fileReference}">
<img class="spon-_image" src="${properties.fileReference}"/>
</div>
This way, the <div> is only rendered, if a fileReference is set. But even if you still want the <div> to appear, your code can be improved by removing the <sly> element and adding the data-sly-test to the <img> tag:
<div class="spon-image-container col-12 col-md-4">
<img class="spon-_image"
src="${properties.fileReference}"
data-sly-test="${properties.fileReference}"/>
</div>
As mentioned in the specification, data-sly-test:
Keeps or removes the element depending on the attribute value.
For your case if fileReferece property evaluates to true (not null, not empty), it will render:
<div class="spon-image-container col-12 col-md-4">
<img class="spon-_image" src="....."/>
</div>
Note that the sly tag unwraps/removes itself, it's actually unnecessary here as the data-sly-test attribute could be moved to the img.
If fileReference evaluates to false, it will render:
<div class="spon-image-container col-12 col-md-4">
</div>
It basically checks if the current resource properties(i.e component properties) contain fileRefernce then it will add an image tag.
How can I use ngModel for inputs across multiple forms that's repeated by ngFor?
Angular2 gives me error when I'm trying to do so.
Error: Permission denied to access property "rejection"
Example block of problematic code:
<div *ngFor="let item of items">
<form name="itemForm">
{{item.name}}<input [(ngModel)]="item.name">
</form>
</div>
Here is the plunker
https://plnkr.co/edit/YNZiCBeyqJoxO5ox5nlC?p=preview
If I remove the form tag, it all run without problem, but I need it so I can use enter key on all input to update corresponding data in their own form.
If ngModel is used within a form tag, either the name attribute must be set or the form control must be defined as 'standalone' in ngModelOptions.
Below will work without any error :
<div *ngFor="let item of items">
<form name="itemForm">
{{item.name}}<input [(ngModel)]="item.name" [ngModelOptions]="{standalone: true}">
</form>
</div>
As pointed out by #ranakrunal9 you can use a unique name attribute for your input. Here the code:
<div *ngFor="let item of items; let index=index">
<form name="itemForm">
{{item.name}}<input [(ngModel)]="item.name" name={{index}}>
</form>
</div>
Am trying to fetch and display the items from my collection.
I created the template and gave it the design for each item. Here is the code:
<template name="list_products">
{{#each applications}}
<div class="col-sm-4 col-lg-4 col-md-4">
<div class="thumbnail">
<img src="http://placehold.it/320x150" alt="">
<div class="caption">
<h4 class="pull-right">{{price}}</h4>
<h4>{{title}}
</h4>
<p>{{description}}</p>
</div>
</div>
</div>
{{/each}}
</template>
on the .js file, i created the applications that will return all the items in the collection
Template.list_products.applications = function(){
Products.find();
}
then i called the template in the .html file
{{> list_products}}
I got this error once i run "npm run start"
Refused to execute script from 'http://localhost:3000/js/jquery.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled
what am i doing wrong? any steps am missing here?
Do it by using a helper.
Template.list_products.helpers({
applications:function(){
return Products.find({});
}
});
Again you could iterate through the applications because it will return a cursor. It is possible also to return Products.find({}).fetch();
But first try with the cursor in order to see if it works.
I am using ng-flow in my app, is there any way to limit the number of files for upload?
A code sample:
<div class="thumbnail" ng-show="$flow.files.length">
<img flow-img="$flow.files[0]" />
</div>
<div>
Select image
Change
<a href="#" class="btn btn-danger" ng-show="$flow.files.length"
ng-click="$flow.cancel()">
Remove
</a>
</div>
The attribute flow-file-added is expecting a boolean value.
You can put all your conditions in there.
$flow.files.length returns the number a files you have already added
For example:
<div flow-init flow-files-submitted="$flow.upload()" flow-file-added="$flow.files.length<3"></div>
I found a w3m plugin in w3m-extension.el for English-Chinese dict like this:
(defun w3m-search-dict-cn ()
"Translate input word and search from dict.cn."
(interactive)
(w3m-search-advance "http://dict.cn/search/?q=" "English Dict.cn" 'gbk))
I configue the w3m plugin to search the dict online using the youdao dict website.
(defun w3m-search-dict-cn ()
"Translate input word and search from youdao.cn."
(interactive)
(w3m-search-advance "http://dict.youdao.com/search?q=" "English youdao.cn" 'UTF-8))
But I found that the result info is too large to read .
What i want is just
<div id="collinsResult" class="tab-content">
<div class="trans-container">
<div class="trans-content">
<div class="collinsToggle trans-container">
<div class="wt-container">
<h4>
<span class="title">exception</span>
<em class="additional spell phonetic">/ɪkˈsɛpʃən/</em>
<span class="star star3" title="使用频率"></span>
<span class="via rank">CET4 TEM4</span>
<span class="additional pattern">(
exceptions
)</span>
</h4>
<ul class="ol">
<li>
<div class="collinsMajorTrans">
<span class="collinsOrder">1. </span>
<p>
<span class="additional" title="可数名词">N-COUNT</span>
An <b>exception</b> is a particular thing, person, or situation that is not included in a general statement, judgment, or rule. 例外
</p></div>
<div class="exampleLists">
<span class="collinsOrder">例:</span>
<div class="examples">
<p> Few guitarists can sing as well as they can play; Eddie, however, is an exception. </p>
<p>很少有吉他手唱歌能唱得跟弹得一样好,而艾迪是个例外。</p>
</div>
</div>
<div class="exampleLists">
<span class="collinsOrder">例:</span>
<div class="examples">
<p> The law makes no exceptions. </p>
<p>法律不搞例外。</p>
</div>
</div>
</li>
<li>
<div class="collinsMajorTrans">
<span class="collinsOrder">2. </span>
<p>
<span class="additional" title="习语">PHRASE</span>
If you make a general statement, and then say that something or someone is <b>no exception</b>, you are emphasizing that they are included in that statement. 不例外; 无例外
<span class="additional">[强调]</span>
</p></div>
<div class="exampleLists">
<span class="collinsOrder">例:</span>
<div class="examples">
<p> Marketing is applied to everything these days, and books are no exception. </p>
<p>现在市场营销用于任何事物,图书也不例外。</p>
</div>
</div>
</li>
<li>
<div class="collinsMajorTrans">
<span class="collinsOrder">3. </span>
<p>
<span class="additional" title="习语">PHRASE</span>
If you <b>take exception to</b> something, you feel offended or annoyed by it, usually with the result that you complain about it. 厌恶; 反感
</p></div>
<div class="exampleLists">
<span class="collinsOrder">例:</span>
<div class="examples">
<p> He also took exception to having been spied on. </p>
<p>他也厌恶被暗中监视。</p>
</div>
</div>
</li>
<li>
<div class="collinsMajorTrans">
<span class="collinsOrder">4. </span>
<p>
<span class="additional" title="习语">PHRASE</span>
You use <b>with the exception of</b> to introduce a thing or person that is not included in a general statement that you are making. 除外
</p></div>
<div class="exampleLists">
<span class="collinsOrder">例:</span>
<div class="examples">
<p> Yesterday was a day off for everybody, with the exception of Lorenzo. </p>
<p>昨天每个人休一天假,洛伦佐除外。</p>
</div>
</div>
</li>
</div>
</div>
</div>
</div>
</div>
when i search the word "exception" not the whole page.
How can I use the w3m to download the page and get what i want part of the html and then display in the emacs buffer?
M-x w3m-view-source, display source code
M-x html-mode, or any other mode providing the convenient key-binding
Mark the part of interest
M-x copy-to-buffer MY_NEW_BUFFER
Add <html>``</html> tags if missing in section
M-x w3m-buffer, display selected content