Angular 1 / ui-router - 仅限Firefox

时间:2017-10-02 03:30:21

标签: javascript angularjs angular-ui-router angular-routing

当我到达状态project.detail.edit.headers.contact.create.type.overlay.simplified(代码中的最后一个状态)时出现此错误TypeError error: contact.typeRef is undefined

.state({
      name: 'project.detail.edit.headers.contact',
      url: '/contact',
      abstract: true,
      data: {
        skipFooter: true,
        cancelState: 'project.detail.edit.headers'
      },
      views: {
        'overlay@agent.production': {
          component: 'overlayContent'
        }
      },
      resolve: {
        contactTypes: (ContactService) => ContactService.getContactTypes()
      }
    })
    .state({
      name: 'project.detail.edit.headers.contact.create',
      url: '/create',
      abstract: true,
    })
    .state({
      name: 'project.detail.edit.headers.contact.create.type',
      url: '/{type:string}',
      params: {
        type: ContactTypes.physical,
        step: null
      },
      component: 'contactCreatePage',
      resolve: {
        contactType: (contact, contactTypes, $stateParams, ContactService, ContactStepTemplates, UtilService) => {
          let isOpened = null
          if (!contact.typeRef || contact.type !== $stateParams.type) {
            ContactService.switchContactType(contact, $stateParams.type, contactTypes)
            isOpened = (step, index) => !$stateParams.step && index === 0
          }
          UtilService.setStepsTemplate(contact.typeRef.steps, ContactStepTemplates, isOpened)
          return contact.typeRef
        },
        currentStep: (contactType, $stateParams, UtilService) => UtilService.getStepByName(contactType.steps, $stateParams.step)
      }
    })
    .state({
      name: 'project.detail.edit.headers.contact.create.type.overlay',
      url: '',
      abstract: true,
      views: {
        'overlay@agent.production': {
          component: 'overlayContent'
        }
      }
    })
    .state({
      name: 'project.detail.edit.headers.contact.create.type.overlay.simplified',
      url: '/simplified',
      component: 'contactSimplified'
    })

奇怪的是,如果我删除了网址url: '/simplified',并且在之前状态$stateParams.type的{​​{1}}变为project.detail.edit.headers.contact.create.type,则physical_contact/simplified正常但不是physical_contact。 此问题仅适用于Firefox和Safari

Angular 1.6.1 - ui-router 1.0.0-rc.1

0 个答案:

没有答案