Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

$resolve is undefined when used within an ionView #91

Open
jgw96 opened this issue Jan 13, 2017 · 1 comment
Open

$resolve is undefined when used within an ionView #91

jgw96 opened this issue Jan 13, 2017 · 1 comment
Labels

Comments

@jgw96
Copy link
Contributor

jgw96 commented Jan 13, 2017

From @TheCopartnery on September 20, 2016 14:58

PROBLEM:

$resolve is undefined when used within an ionView

$resolve should work correctly, just as it does for ngView

WORKAROUND / CODE FIX:

To work around the issue using the current version of Ionic create a file called ionic-overrides.js and add the following code...

  angular.module('app').directive('ionView', function($state) {
    return {
      restrict: 'EA',
      priority: 999999,
      link: function($scope, $element, $attrs, viewCtrl) {
          if ($state.$current && $state.$current.locals) {
              $scope.$resolve = $state.$current.locals.globals;
          }
      }
    };
  });

Link to this file in your index.html just below your script link for app.js.

Functionality added in Angular 1.5.0-rc0

ngView: reference resolved locals in scope, resolveAs: '$resolve'

983b0598 - angular/angular.js@983b059
#13400 - angular/angular.js#13400

INFO

Ionic 1.3.1
Cordova CLI: 6.1.1
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic CLI Version: 2.0.0
Ionic App Lib Version: 2.0.0-beta.20
OS: Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS
Node Version: v4.4.2

Copied from original issue: ionic-team/ionic-framework#8140

@jgw96 jgw96 added the v1 label Jan 13, 2017
@jgw96
Copy link
Contributor Author

jgw96 commented Jan 13, 2017

From @mlynch on September 21, 2016 2:15

Thanks for the workaround, we appreciate it and hope it helps others in the meantime.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant