Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
ngx-bar-rating
Advanced tools
Install it with npm
npm install --save ngx-bar-rating
If you are using SystemJS, you should also adjust your configuration to point to the UMD bundle.
In your systemjs config file, map needs to tell the System loader where to look for ngx-bar-rating:
map: {
'ngx-bar-rating': 'node_modules/ngx-bar-rating/bundles/ngx-bar-rating.umd.js',
}
Import BarRatingModule
in the root module
import { BarRatingModule } from "ngx-bar-rating";
@NgModule({
imports: [
// ...
BarRatingModule
]
})
In your template
<bar-rating [(rate)]="rate" [max]="5"></bar-rating>
[rate]: Current rating. Can be a decimal value like 3.14, default undefined
[max]: Maximal rating that can be given using this widget.
[readOnly]: A flag indicating if rating can be updated.
[theme]: Theme class. default default
, see available themes.
[showText]: Display rating title if set, otherwise display rate value, default false
.
[titles]: Titles array. current rate value the title displayed each index of the array represents the rate value, default []
.
[required]: A flag indicating if rating is required for form validation., default false
.
[disabled]: A flag indicating if rating is disabled. works only with forms, default false
.
(rateChange): An event fired when a user selects a new rating. Event's payload equals to the newly selected rating.
(hover): An event fired when a user is hovering over a given rating. Event's payload equals to the rating being hovered over.
(leave): An event fired when a user stops hovering over a given rating. Event's payload equals to the rating of the last item being hovered over.
<bar-rating [(rate)]="rate" [max]="4" [theme]="'movie'" [titles]="['Bad', 'Mediocre' , 'Good', 'Awesome']"></bar-rating>
It can be used with angular forms and reactive forms, for example:
<form #form="ngForm">
<bar-rating name="rating" [(ngModel)]="formRating" [max]="4" required disabled></bar-rating>
</form>
<p>form is valid: {{ form.valid ? 'true' : 'false' }}</p>
<pre>{{ formRating }}</pre>
Import rating theme using in the global style style.css
@import '~ngx-bar-rating/themes/br-default-theme';
@import '~ngx-bar-rating/themes/br-bootstrap-theme';
@import '~ngx-bar-rating/themes/br-fontawesome-theme';
@import '~ngx-bar-rating/themes/br-fontawesome-o-theme';
@import '~ngx-bar-rating/themes/br-horizontal-theme';
@import '~ngx-bar-rating/themes/br-vertical-theme';
@import '~ngx-bar-rating/themes/br-custom-stars-theme';
@import '~ngx-bar-rating/themes/br-movie-theme';
@import '~ngx-bar-rating/themes/br-square-theme';
You can extend or create your own theme using these classes
.br {
// rating wrapper
.br-units {
// units container
}
.br-unit {
// units (stars)
&.br-active{
// hovered units (stars)
}
&.br-selected {
// selected units (stars)
}
}
&.br-readonly {
.br-active, .br-selected {
// selected or active in read
}
}
.br-text {
// Rate text
}
}
You can also do the same for forms classes such as untouched, touched, dirty, invalid, valid ...etc
If you have a nice rating style you would like to share, propuse your theme and I will include it in the package.
If you identify any errors in this component, or have an idea for an improvement, please open an issue. I am excited to see what the community thinks of this project, and I would love your input!
Murhaf Sousli
0.9.0
FAQs
Angular Bar Rating
The npm package ngx-bar-rating receives a total of 5,719 weekly downloads. As such, ngx-bar-rating popularity was classified as popular.
We found that ngx-bar-rating demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.