| 191 | statesTree = loadStates({}, states, ''); |
| 192 | |
| 193 | function loadStates(parent, state, name) { |
| 194 | let thisState: any = pick(state, stateProps); |
| 195 | const substates: any = omit(state, stateProps); |
| 196 | |
| 197 | thisState.template = thisState.template || 'empty'; |
| 198 | thisState.name = name; |
| 199 | thisState.parent = parent.name; |
| 200 | thisState.params = {}; |
| 201 | thisState.data = { children: [] }; |
| 202 | |
| 203 | angular.forEach(substates, function (value, key) { |
| 204 | thisState.data.children.push(loadStates(thisState, value, key)); |
| 205 | }); |
| 206 | thisState = StateObject.create(thisState); |
| 207 | statesMap[name] = thisState; |
| 208 | return thisState; |
| 209 | } |
| 210 | }); |
| 211 | |
| 212 | function makePath(names: string[]): PathNode[] { |