--- title: TB widget develop tags: Ongoing, ThingsBoard --- ## Custom Service Injection ( rebuild needed ) 1. Create service.ts * `ng g s /path/to/customService` 2. Add custom Service into servicesMap * path - `src/app/modules/home/models/services.map.ts` ``` export const ServicesMap = new Map<string, Type<any>>( [ + ['customService', CustomService], ['broadcastService', BroadcastService], ['deviceService', DeviceService], ['alarmService', AlarmService], ... ``` 3. Get service ``` let customService = self.ctx.$scope.$injector.get(self.ctx.servicesMap.get('customService')); ``` ## Custom Action * Default tag 1. `<link-act name="actionName">link</link-act>` 2. `<button-act name="actionName">button</button-act>` * Custom tag * add `class="tb-custom-action"` & `data-action-name="actionName"` to binding custom action * example: `<button class="tb-custom-action" data-action-name="actionName"></button>`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up