https://github.com/fernandomoraes/angular-prefetching-templates-poc
https://github.com/fernandomoraes/angular-prefetching-templates-poc
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fernandomoraes/angular-prefetching-templates-poc
- Owner: fernandomoraes
- Created: 2017-07-01T16:21:28.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-01T19:22:10.000Z (almost 9 years ago)
- Last Synced: 2025-02-06T09:47:42.158Z (over 1 year ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# angular-prefetching-templates-poc
This is a simple proof of concept, exemplifying a way to perform pre fetching on demand of mapped states html templates.
## How its works:
Created a mechanism that loads the template when the 'ui-sref' directive is present. Through the value assigned to ui-sref, the state's settings are retrieved and the html loading done, this can be seen in ````src/ui-sref.decorator.js````
**Some things that can be improved:**
* Does not load template when directive is disabled.
* Multiple requests to load the same template at the same time. See load method in TemplateLoader service, one option would be to check if the template is already being loaded.
* Only prefetching when the application is idle, thus ensuring that the main requisites are not impaired due to lack of resources.
## Run:
To run, any http server can be used:
```bash
cd src && python -m SimpleHTTPServer
```
Open the browser debug and check the requests.