How can I switch between using one class or another in AngularJS?
I have the following code:
<i style="margin-right: 0.5em; color: #EEEEEE;" class="icon-home
icon-4x"></i>
I would like to change the color of the SVG icon depending on if my
ui-router state as follows:
If the state includes 'admin' I would like it to use the class red-icon
If the state does not include 'admin' I would like it to use the class
blue-icon
I have done something like this before:
data-ng-class="{ current: $state.includes('admin') }"
But how can I make it switch between the two colors?
Butanda
Sunday, 1 September 2013
Saturday, 31 August 2013
Tinymce url needs to be versatile
Tinymce url needs to be versatile
I need relative path in links which don't have full url and i don't need
relative path in url which have full url.
When i insert in tinymce:
1. I need full url(non-relative path) in:
"http://dignepal.com/images/logo.png"
2. But i don't need full url (relative path) in: "javascript:"
While initializing tinymce i am currently using relative_urls as false and
it is causing problem in number 2 problem as mentioned above. And main
problem is i need it in same page and in same textarea.
I need relative path in links which don't have full url and i don't need
relative path in url which have full url.
When i insert in tinymce:
1. I need full url(non-relative path) in:
"http://dignepal.com/images/logo.png"
2. But i don't need full url (relative path) in: "javascript:"
While initializing tinymce i am currently using relative_urls as false and
it is causing problem in number 2 problem as mentioned above. And main
problem is i need it in same page and in same textarea.
Does move semantic unsuitable to the array in C++11?
Does move semantic unsuitable to the array in C++11?
I test the unique_ptr<> as follow
#include <iostream>
#include <memory>
using namespace std;
class A
{
public:
virtual ~A() {}
virtual void print()
{
cout << "A::Print()" << endl;
}
};
class B : public A
{
public:
virtual ~B() {}
virtual void print()
{
cout << "B::Print()" << endl;
}
};
int main()
{
A a;
B b;
A* arr[2] = {&a, &b};
arr[0]->print();
arr[1]->print();
unique_ptr<A*[]> ptr(move(arr));
/*
unique_ptr<A*[]> ptr(new A*[2]{&a, &b});
*/
ptr[0]->print();
ptr[1]->print();
return 0;
}
It get the result like (g++ 4.7.3)
A::Print()
B::Print()
A::Print()
B::Print()
Aborted (core dumped)
It seem like the ptr and arr point to the samething and when call
destructor, it has been deleted twice.
Why the move semantic don't take effect here?
Does it unsuitable to the array or it is about the unique_ptr?
I test the unique_ptr<> as follow
#include <iostream>
#include <memory>
using namespace std;
class A
{
public:
virtual ~A() {}
virtual void print()
{
cout << "A::Print()" << endl;
}
};
class B : public A
{
public:
virtual ~B() {}
virtual void print()
{
cout << "B::Print()" << endl;
}
};
int main()
{
A a;
B b;
A* arr[2] = {&a, &b};
arr[0]->print();
arr[1]->print();
unique_ptr<A*[]> ptr(move(arr));
/*
unique_ptr<A*[]> ptr(new A*[2]{&a, &b});
*/
ptr[0]->print();
ptr[1]->print();
return 0;
}
It get the result like (g++ 4.7.3)
A::Print()
B::Print()
A::Print()
B::Print()
Aborted (core dumped)
It seem like the ptr and arr point to the samething and when call
destructor, it has been deleted twice.
Why the move semantic don't take effect here?
Does it unsuitable to the array or it is about the unique_ptr?
Custom String representation of an Object in Java
Custom String representation of an Object in Java
Is there any way to change how an object represents itself as a String?
For example, having System.out.println(new JLabel()); output Empty JLabel.
Is there any way to change how an object represents itself as a String?
For example, having System.out.println(new JLabel()); output Empty JLabel.
jquery - gridster, still linking on page even after drag
jquery - gridster, still linking on page even after drag
so my problem is next. Im using gridster.js and after long researching of
stackoverlow i found a numerous similar solutions for this problem, but
again, i couldnt implement that on my issue. So the issue here is that i
want to link an ID to web-page, but only when i fully click on that box
inside of gridster. Issue is, when i move the very same box, and do a
mouseover, i still get linked on that page. Difference here is that im not
using any tags like previous guys did in their posts, so im basically
trying to link it over simple ID.
http://jsfiddle.net/tr4cU/23/`">FIDDLE LINK
also there is code here:
var gridster;
$(function() {
gridtster = $(".gridster > ul").gridster({
widget_margins: [10, 10],
widget_base_dimensions: [140, 140],
min_cols: 6
}).data('gridster');
$('#contacts').click(function () {
window.location = $(this).attr("url");
});
});
so my problem is next. Im using gridster.js and after long researching of
stackoverlow i found a numerous similar solutions for this problem, but
again, i couldnt implement that on my issue. So the issue here is that i
want to link an ID to web-page, but only when i fully click on that box
inside of gridster. Issue is, when i move the very same box, and do a
mouseover, i still get linked on that page. Difference here is that im not
using any tags like previous guys did in their posts, so im basically
trying to link it over simple ID.
http://jsfiddle.net/tr4cU/23/`">FIDDLE LINK
also there is code here:
var gridster;
$(function() {
gridtster = $(".gridster > ul").gridster({
widget_margins: [10, 10],
widget_base_dimensions: [140, 140],
min_cols: 6
}).data('gridster');
$('#contacts').click(function () {
window.location = $(this).attr("url");
});
});
How to target individually nested elements using CSS
How to target individually nested elements using CSS
I'm trying to target each span individually in a structure like below.
I've tried nth-child() & nth-of-type() but I've have no luck, it was only
applying the first style to all of the spans. Anyone no know how to do
this without giving each a separate IDs?
<div>
<div>
<span></span>
</div>
<div>
<span></span>
</div>
<div>
<span></span>
</div>
</div>
I'm trying to target each span individually in a structure like below.
I've tried nth-child() & nth-of-type() but I've have no luck, it was only
applying the first style to all of the spans. Anyone no know how to do
this without giving each a separate IDs?
<div>
<div>
<span></span>
</div>
<div>
<span></span>
</div>
<div>
<span></span>
</div>
</div>
Javascript setter and getter with key for object
Javascript setter and getter with key for object
I have an object in a variable var o={}; I want to do something like what
.push() method doing in array for my object.
JS code:
// Array:
var ar=[];
ar.push('omid');
ar.push('F');
var got=ar[1];
// above code is standard but not what I'm looking for !
/*-------------------------------------*/
// Object:
var obj={};
/* obj.push('key','value'); // I want do something like this
var got2=obj.getVal('key'); // And this
*/
I want to have result like this:
JS code:
obj={
key:'value'
}
Is this possible at all ?
I have an object in a variable var o={}; I want to do something like what
.push() method doing in array for my object.
JS code:
// Array:
var ar=[];
ar.push('omid');
ar.push('F');
var got=ar[1];
// above code is standard but not what I'm looking for !
/*-------------------------------------*/
// Object:
var obj={};
/* obj.push('key','value'); // I want do something like this
var got2=obj.getVal('key'); // And this
*/
I want to have result like this:
JS code:
obj={
key:'value'
}
Is this possible at all ?
Subscribe to:
Comments (Atom)