| 1 | import {componentWriter} from '../../writers'; |
| 2 | |
| 3 | export const View = config => t => { |
| 4 | if( typeof config !== 'object' || ( !config.templateUrl && !config.template ) || t === undefined ) |
| 5 | { |
| 6 | throw new Error('Config object must be passed to the view decorator with either a view url or an inline template'); |
| 7 | } |
| 8 | |
| 9 | if(config.templateUrl) |
| 10 | { |
| 11 | if(componentWriter.has('template', t)) |
| 12 | { |
| 13 | componentWriter.set('template', undefined, t); |
| 14 | } |
| 15 | |
| 16 | componentWriter.set('templateUrl', config.templateUrl, t); |
| 17 | } |
| 18 | else if(config.template) |
| 19 | { |
| 20 | if(componentWriter.has('templateUrl', t)) |
| 21 | { |
| 22 | componentWriter.set('templateUrl', undefined, t); |
| 23 | } |
| 24 | |
| 25 | componentWriter.set('template', config.template, t); |
| 26 | } |
| 27 | } |
no outgoing calls
no test coverage detected