I like the way even there are many ways:
$("#textbox").on('change keyup paste', function() {
console.log('I am pretty sure the text box changed');
});
I like the way even there are many ways:
$("#textbox").on('change keyup paste', function() {
console.log('I am pretty sure the text box changed');
});
Using .data()
tie data/information to element instead of using variable.
ui-sref
is not dynamic. using ng-click()
with $state.go()
instead
Ref:
My situation is that: I write a web-app like gmail: normal messages, starred messages, label messages sections (3 states). They have same functions except different webservice calling. But format of their result are same:
{
"result": [],
"count": 5
}
I want to use only controller for 3 states. So I use resolve
to achieve that.
Carefully when using ng-if
with directive
. My situation is that I want to show my directive when it meet a condition. There are 2 ways achieve it:
ng-if
when using my custom directive
. The solution is working normally.
--> UPDATE 2015-12-07: use the solution<!-- template.html: I use `directive` here -->
<!-- data is array, I will show array if data.length > 0-->
<my-custom-directive ng-model="data" ng-if="data.length > 0"></my-custom-directive>
I have css code apply html code. Now, I want to re-use it but customizing it. Rule is that always add more class
into new code instead of changing old code (need to change everywhere). Example:
<div class="box">
<div class="header">header</div>
<div class="body">body</div>
<div class="footer">footer</div>
</div>
.dropdown:hover .dropdown-menu { | |
display: block; | |
margin-top: 0; /* remove the gap so it doesn't close*/ | |
} |
I have <button>
is children <a>
, I don't want to make click
event of <a>
occurs when clicking <button>
<a href="#">
<button>do something</button>
sometext
</a>
Solution 1: return false;
in click
handler of ``
Case: you have a <select>
, when it is changed, creating new elements (example: <a>
), and you want to handle click
event of new <a>
<select id="chooser">
<option value="1">Restaurants</option>
<option value="2">Hotels</option>
</select>
<div id="result">
</div>