{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Toasts","type":"basic","slug":"toasts","excerpt":"","body":"[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/RwcOkVjFSLeN2uvHdRcL_1XhwWRQ.png\",\n        \"1XhwWRQ.png\",\n        \"504\",\n        \"180\",\n        \"#343434\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n[Toasts](https://material.angularjs.org/latest/demo/toast) are a component available in Angular Material.\n\nSince most implementations require a success and an error toast, this repository provides you with pre-configured `ToastService` that you can easily adjust to fit your needs.\n\nThis service allows you to open a success toast and an error toast.\nThe error toast is also automatically displayed when the API encounters a validation error (using restangular's [error interceptor](doc:restangular)).\n\nWhile this service has a default delay, position and action text, you can easily change them in `angular/services/toast.service.js`. You can also add custom methods.\n\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"export class PostsController(){\\n  constructor(ToastService){\\n      'ngInject';\\n    \\tthis.ToastService = ToastService;\\n  }\\n  \\n  success(){\\n\\t\\tthis.ToastService.show('Post added successfully!');\\n\\t}\\n    \\n  error(){\\n\\t\\tthis.ToastService.error('Connection interrupted!');\\n\\t}\\n}\",\n      \"language\": \"javascript\",\n      \"name\": \"Toasts Sample\"\n    }\n  ]\n}\n[/block]","updates":[],"order":0,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"57ffd85f755a2e1700c2bb30","githubsync":"","__v":0,"parentDoc":null,"project":"567083021dabd80d00b122ae","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Extras","slug":"extras","order":7,"from_sync":false,"reference":false,"_id":"57ffd85f755a2e1700c2bb0d","createdAt":"2015-12-18T23:14:25.130Z","__v":0,"version":"57ffd85f755a2e1700c2bb05","project":"567083021dabd80d00b122ae"},"createdAt":"2015-12-18T23:28:06.778Z","user":"567082433a32d20d00c45cab","version":{"version":"3.4","version_clean":"3.4.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["57ffd85f755a2e1700c2bb06","57ffd85f755a2e1700c2bb07","57ffd85f755a2e1700c2bb08","57ffd85f755a2e1700c2bb09","57ffd85f755a2e1700c2bb0a","57ffd85f755a2e1700c2bb0b","57ffd85f755a2e1700c2bb0c","57ffd85f755a2e1700c2bb0d"],"_id":"57ffd85f755a2e1700c2bb05","project":"567083021dabd80d00b122ae","releaseDate":"2016-10-13T18:54:23.018Z","__v":1,"createdAt":"2016-10-13T18:54:23.018Z"}}
[block:image] { "images": [ { "image": [ "https://files.readme.io/RwcOkVjFSLeN2uvHdRcL_1XhwWRQ.png", "1XhwWRQ.png", "504", "180", "#343434", "" ] } ] } [/block] [Toasts](https://material.angularjs.org/latest/demo/toast) are a component available in Angular Material. Since most implementations require a success and an error toast, this repository provides you with pre-configured `ToastService` that you can easily adjust to fit your needs. This service allows you to open a success toast and an error toast. The error toast is also automatically displayed when the API encounters a validation error (using restangular's [error interceptor](doc:restangular)). While this service has a default delay, position and action text, you can easily change them in `angular/services/toast.service.js`. You can also add custom methods. [block:code] { "codes": [ { "code": "export class PostsController(){\n constructor(ToastService){\n 'ngInject';\n \tthis.ToastService = ToastService;\n }\n \n success(){\n\t\tthis.ToastService.show('Post added successfully!');\n\t}\n \n error(){\n\t\tthis.ToastService.error('Connection interrupted!');\n\t}\n}", "language": "javascript", "name": "Toasts Sample" } ] } [/block]