Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: angular-ui/ui-router
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.0.18
Choose a base ref
...
head repository: angular-ui/ui-router
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.0.19
Choose a head ref
  • 12 commits
  • 24 files changed
  • 1 contributor

Commits on May 19, 2018

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    13ba660 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8fc3bb2 View commit details
  3. update libs

    christopherthielen committed May 19, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ccc5824 View commit details

Commits on Jun 10, 2018

  1. update libs

    christopherthielen committed Jun 10, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    04ce12a View commit details

Commits on Jun 17, 2018

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2b388cd View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    19dfd9c View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fe91bd3 View commit details

Commits on Jun 20, 2018

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    cd426e5 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1368c18 View commit details

Commits on Jul 16, 2018

  1. update libs

    christopherthielen committed Jul 16, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5a95cbc View commit details

Commits on Jul 20, 2018

  1. update libs

    christopherthielen committed Jul 20, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c776eee View commit details
  2. 1.0.19

    christopherthielen committed Jul 20, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7141abb View commit details
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
## 1.0.19 (2018-07-20)
[Compare `@uirouter/angularjs` versions 1.0.18 and 1.0.19](https://github.com/angular-ui/ui-router/compare/1.0.18...1.0.19)

### Bug Fixes

* **npm:** Publish to the old angular-ui-router npm package too ([8fc3bb2](https://github.com/angular-ui/ui-router/commit/8fc3bb2))
* **resolve:** Detect and honor strictDi in angularjs versions 1.3 and 1.4 ([1368c18](https://github.com/angular-ui/ui-router/commit/1368c18)), closes [#3678](https://github.com/angular-ui/ui-router/issues/3678)
* **state:** When creating absolute hrefs in hashbang mode, include the location.pathname ([cd426e5](https://github.com/angular-ui/ui-router/commit/cd426e5)), closes [#3710](https://github.com/angular-ui/ui-router/issues/3710)
* **uiview:** Allow uiOnParamsChanged to work with states that have a componentProvider ([fe91bd3](https://github.com/angular-ui/ui-router/commit/fe91bd3)), closes [#3707](https://github.com/angular-ui/ui-router/issues/3707)


### Updated `@uirouter/core` from 5.0.19 to 5.0.20
[Compare `@uirouter/core` versions 5.0.19 and 5.0.20](https://github.com/ui-router/core/compare/5.0.19...5.0.20)

### Bug Fixes

* **params:** When creating an array parameter from a custom type, copy the `raw` property ([b6dd738](https://github.com/ui-router/core/commit/b6dd738)), closes [#178](https://github.com/ui-router/core/issues/178)


### Features

* **dynamic:** Support dynamic flag on a state declaration ([3cd5a2a](https://github.com/ui-router/core/commit/3cd5a2a))
* **transition:** Added transition.paramsChanged() to get added/deleted/changed parameter values for a transition ([10b7fde](https://github.com/ui-router/core/commit/10b7fde))
* **view:** Add _pluginapi._registeredUIView() to get a ui-view by id ([6533b51](https://github.com/ui-router/core/commit/6533b51))

## 1.0.18 (2018-05-19)
[Compare `@uirouter/angularjs` versions 1.0.17 and 1.0.18](https://github.com/angular-ui/ui-router/compare/1.0.17...1.0.18)

4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -17,5 +17,5 @@
"test",
"src"
],
"version": "1.0.17"
}
"version": "1.0.18"
}
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@uirouter/angularjs",
"description": "State-based routing for AngularJS 1.x",
"version": "1.0.18",
"version": "1.0.19",
"scripts": {
"clean": "shx rm -rf lib lib-esm _doc build release *.log",
"compile": "tsc && tsc -m es6 --outDir lib-esm && npm run fixdts",
@@ -26,7 +26,7 @@
"debug": "karma start --singleRun=false --autoWatch=true --autoWatchInterval=1 --browsers=Chrome",
"docs": "generate_docs",
"docs:publish": "generate_docs && publish_docs",
"release": "release --deps @uirouter/core && node ./scripts/bower_release.js",
"release": "release --deps @uirouter/core && node ./scripts/npm_angular_ui_router_release.js && node ./scripts/bower_release.js",
"prepublishOnly": "npm run build",
"artifacts": "artifact_tagging",
"precommit": "pretty-quick --staged"
@@ -72,23 +72,23 @@
"jsnext:main": "lib-esm/index.js",
"typings": "lib/index.d.ts",
"dependencies": {
"@uirouter/core": "5.0.19"
"@uirouter/core": "5.0.20"
},
"peerDependencies": {
"angular": ">=1.2.0"
},
"devDependencies": {
"@types/angular": "=1.6.25",
"@types/angular-animate": "^1.5.9",
"@types/angular-mocks": "^1.5.11",
"@types/jasmine": "^2.8.7",
"@types/jquery": "^3.3.1",
"@uirouter/publish-scripts": "^2.3.18",
"@types/angular-animate": "^1.5.10",
"@types/angular-mocks": "^1.6.1",
"@types/jasmine": "^2.8.8",
"@types/jquery": "^3.3.4",
"@uirouter/publish-scripts": "^2.3.20",
"dts-downlevel": "^0.3.0",
"fork-ts-checker-webpack-plugin": "^0.4.1",
"fork-ts-checker-webpack-plugin": "^0.4.3",
"husky": "^0.14.3",
"jasmine-core": "^3.1.0",
"karma": "^2.0.2",
"karma": "^2.0.4",
"karma-chrome-launcher": "^2.2.0",
"karma-jasmine": "^1.1.2",
"karma-mocha-reporter": "^2.2.5",
@@ -97,16 +97,16 @@
"karma-super-dots-reporter": "^0.2.0",
"karma-webpack": "^3.0.0",
"lodash": "^4.17.10",
"prettier": "^1.12.1",
"pretty-quick": "^1.4.1",
"rollup": "^0.58.2",
"prettier": "^1.13.7",
"pretty-quick": "^1.6.0",
"rollup": "^0.63.4",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-uglify": "^3.0.0",
"ts-loader": "^4.3.0",
"tslint": "^5.10.0",
"tslint-eslint-rules": "^5.2.0",
"typescript": "^2.8.3",
"webpack": "^4.8.3"
"rollup-plugin-uglify": "^4.0.0",
"ts-loader": "^4.4.2",
"tslint": "^5.11.0",
"tslint-eslint-rules": "^5.3.1",
"typescript": "^2.9.2",
"webpack": "^4.16.1"
}
}
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import nodeResolve from 'rollup-plugin-node-resolve';
import uglify from 'rollup-plugin-uglify';
import { uglify } from 'rollup-plugin-uglify';
import sourcemaps from 'rollup-plugin-sourcemaps';

const MINIFY = process.env.MINIFY;
17 changes: 17 additions & 0 deletions scripts/npm_angular_ui_router_release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!env node
'use strict';
const fs = require('fs');
const path = require('path');
const util = require('@uirouter/publish-scripts/util');
const version = require('../package.json').version;
const _exec = util._exec;

util.packageDir();
const packagePath = path.resolve(__dirname, '..', 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packagePath));
util.ensureCleanMaster('master');
packageJson.name = 'angular-ui-router';
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2));

_exec(`npm publish`);
_exec(`git checkout package.json`);
6 changes: 3 additions & 3 deletions src/directives/stateDirectives.ts
Original file line number Diff line number Diff line change
@@ -100,9 +100,9 @@ function clickHook(
if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) {
// HACK: This is to allow ng-clicks to be processed before the transition is initiated:
const transition = $timeout(function() {
if (!el.attr('disabled')) {
$state.go(target.uiState, target.uiStateParams, target.uiStateOpts);
}
if (!el.attr('disabled')) {
$state.go(target.uiState, target.uiStateParams, target.uiStateOpts);
}
});
e.preventDefault();

12 changes: 5 additions & 7 deletions src/directives/viewDirective.ts
Original file line number Diff line number Diff line change
@@ -410,9 +410,8 @@ function $ViewDirectiveFill(
scope[resolveAs] = locals;

if (controller) {
const controllerInstance = <Ng1Controller>$controller(
controller,
extend({}, locals, { $scope: scope, $element: $element })
const controllerInstance = <Ng1Controller>(
$controller(controller, extend({}, locals, { $scope: scope, $element: $element }))
);
if (controllerAs) {
scope[controllerAs] = controllerInstance;
@@ -431,17 +430,16 @@ function $ViewDirectiveFill(
}

// Wait for the component to appear in the DOM
if (isString(cfg.viewDecl.component)) {
const cmp = cfg.viewDecl.component;
const kebobName = kebobString(cmp);
if (isString(cfg.component)) {
const kebobName = kebobString(cfg.component);
const tagRegexp = new RegExp(`^(x-|data-)?${kebobName}$`, 'i');

const getComponentController = () => {
const directiveEl = [].slice
.call($element[0].children)
.filter((el: Element) => el && el.tagName && tagRegexp.exec(el.tagName));

return directiveEl && angular.element(directiveEl).data(`$${cmp}Controller`);
return directiveEl && angular.element(directiveEl).data(`$${cfg.component}Controller`);
};

const deregisterWatch = scope.$watch(getComponentController, function(ctrlInstance) {
20 changes: 13 additions & 7 deletions src/locationServices.ts
Original file line number Diff line number Diff line change
@@ -4,15 +4,17 @@
*/ /** */
import { LocationConfig, LocationServices, UIRouter, ParamType, isDefined } from '@uirouter/core';
import { val, createProxyFunctions, removeFrom, isObject } from '@uirouter/core';
import { ILocationService, ILocationProvider } from 'angular';
import { ILocationService, ILocationProvider, IWindowService } from 'angular';

/**
* Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service
*/
export class Ng1LocationServices implements LocationConfig, LocationServices {
private $locationProvider: ILocationProvider;
private $location: ILocationService;
private $sniffer;
private $sniffer: any;
private $browser: any;
private $window: IWindowService;

path;
search;
@@ -21,7 +23,8 @@ export class Ng1LocationServices implements LocationConfig, LocationServices {
port;
protocol;
host;
baseHref;

private _baseHref: string;

// .onChange() registry
private _urlListeners: Function[] = [];
@@ -67,27 +70,30 @@ export class Ng1LocationServices implements LocationConfig, LocationServices {
return html5Mode && this.$sniffer.history;
}

baseHref() {
return this._baseHref || (this._baseHref = this.$browser.baseHref() || this.$window.location.pathname);
}

url(newUrl?: string, replace = false, state?) {
if (isDefined(newUrl)) this.$location.url(newUrl);
if (replace) this.$location.replace();
if (state) this.$location.state(state);
return this.$location.url();
}

_runtimeServices($rootScope, $location: ILocationService, $sniffer, $browser) {
_runtimeServices($rootScope, $location: ILocationService, $sniffer, $browser, $window: IWindowService) {
this.$location = $location;
this.$sniffer = $sniffer;
this.$browser = $browser;
this.$window = $window;

// Bind $locationChangeSuccess to the listeners registered in LocationService.onChange
$rootScope.$on('$locationChangeSuccess', evt => this._urlListeners.forEach(fn => fn(evt)));
const _loc = val($location);
const _browser = val($browser);

// Bind these LocationService functions to $location
createProxyFunctions(_loc, this, _loc, ['replace', 'path', 'search', 'hash']);
// Bind these LocationConfig functions to $location
createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']);
// Bind these LocationConfig functions to $browser
createProxyFunctions(_browser, this, _browser, ['baseHref']);
}
}
28 changes: 19 additions & 9 deletions src/services.ts
Original file line number Diff line number Diff line change
@@ -41,13 +41,13 @@ import { Ng1LocationServices } from './locationServices';
import { UrlRouterProvider } from './urlRouterProvider';
import IInjectorService = angular.auto.IInjectorService; // tslint:disable-line

angular.module("ui.router.angular1", []);
const mod_init = angular.module('ui.router.init', ['ng']);
const mod_util = angular.module('ui.router.util', ['ui.router.init']);
const mod_rtr = angular.module('ui.router.router', ['ui.router.util']);
const mod_state = angular.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']);
const mod_main = angular.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']);
const mod_cmpt = angular.module('ui.router.compat', ['ui.router']); // tslint:disable-line
angular.module('ui.router.angular1', []);
const mod_init = angular.module('ui.router.init', ['ng']);
const mod_util = angular.module('ui.router.util', ['ui.router.init']);
const mod_rtr = angular.module('ui.router.router', ['ui.router.util']);
const mod_state = angular.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']);
const mod_main = angular.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']);
const mod_cmpt = angular.module('ui.router.compat', ['ui.router']); // tslint:disable-line

declare module '@uirouter/core/lib/router' {
interface UIRouter {
@@ -85,16 +85,17 @@ function $uiRouterProvider($locationProvider: ILocationProvider) {
// backwards compat: also expose router instance as $uiRouterProvider.router
router['router'] = router;
router['$get'] = $get;
$get.$inject = ['$location', '$browser', '$sniffer', '$rootScope', '$http', '$templateCache'];
$get.$inject = ['$location', '$browser', '$window', '$sniffer', '$rootScope', '$http', '$templateCache'];
function $get(
$location: ILocationService,
$browser: any,
$window: any,
$sniffer: any,
$rootScope: ng.IScope,
$http: IHttpService,
$templateCache: ITemplateCacheService
) {
ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser);
ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser, $window);
delete router['router'];
delete router['$get'];
return router;
@@ -117,6 +118,15 @@ function runBlock($injector: IInjectorService, $q: IQService, $uiRouter: UIRoute
services.$injector = $injector;
services.$q = <any>$q;

// https://github.com/angular-ui/ui-router/issues/3678
if (!$injector.hasOwnProperty('strictDi')) {
try {
$injector.invoke(function(checkStrictDi) {});
} catch (error) {
$injector.strictDi = !!/strict mode/.exec(error && error.toString());
}
}

// The $injector is now available.
// Find any resolvables that had dependency annotation deferred
$uiRouter.stateRegistry
46 changes: 21 additions & 25 deletions test/ng1StateBuilderSpec.ts
Original file line number Diff line number Diff line change
@@ -36,30 +36,26 @@ describe('Ng1 StateBuilder', function() {
expect(builtViews.a.controller).toEqualData(config.a.controller);
});

it(
'should not allow a view config with both component and template keys',
inject(function($injector) {
const config = {
name: 'foo',
url: '/foo',
template: '<h1>hey</h1>',
controller: 'FooController',
parent: parent,
};
expect(() => builder.builder('views')(config)).not.toThrow();
expect(() => builder.builder('views')(extend({ component: 'fooComponent' }, config))).toThrow();
expect(() => builder.builder('views')(extend({ componentProvider: () => 'fooComponent' }, config))).toThrow();
expect(() => builder.builder('views')(extend({ bindings: {} }, config))).toThrow();
})
);
it('should not allow a view config with both component and template keys', inject(function($injector) {
const config = {
name: 'foo',
url: '/foo',
template: '<h1>hey</h1>',
controller: 'FooController',
parent: parent,
};
expect(() => builder.builder('views')(config)).not.toThrow();
expect(() => builder.builder('views')(extend({ component: 'fooComponent' }, config))).toThrow();
expect(() => builder.builder('views')(extend({ componentProvider: () => 'fooComponent' }, config))).toThrow();
expect(() => builder.builder('views')(extend({ bindings: {} }, config))).toThrow();
}));

it(
'should replace a resolve: string value with a function that injects the service of the same name',
inject(function($injector) {
const config = { resolve: { foo: 'bar' } };
expect(builder.builder('resolvables')).toBeDefined();
const built: Resolvable[] = builder.builder('resolvables')(config);
expect(built[0].deps).toEqual(['bar']);
})
);
it('should replace a resolve: string value with a function that injects the service of the same name', inject(function(
$injector
) {
const config = { resolve: { foo: 'bar' } };
expect(builder.builder('resolvables')).toBeDefined();
const built: Resolvable[] = builder.builder('resolvables')(config);
expect(built[0].deps).toEqual(['bar']);
}));
});
Loading