Hi Sander,

thank you for your quick reply.

I implemented your function in my controller and passed my values to an 
button: 
button(ng-click="checkBits(obj.currentrights, 2)") CheckBit

The output of the 2 values are 15 (correct) and 2.

I'm not sure what to do now?! Could you please assist me?
Thank you.
Regards
Christoph

Am Montag, 11. August 2014 14:45:04 UTC+2 schrieb Sander Elias:
>
> Hi Christoph,
>
> ahh, good old times, you are trying to use a 8bit bitmask right?
> Angular expressions are not javascript. Perhaps bitwise operators won’t 
> work at all. (I didn’t try, I could be off here!)
> here is a small helper function that might be of use:
>
> function hasbit(val, bitnum) {
>    var mask = parseInt(bitnum ? '1' + Array(bitnum).join('0') : '0', 2) ;
>    return !! (val & mask > 0);
> }
>
> Regards
> Sander
> ​
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to