How to use the @uirouter/core.UIRouter function in @uirouter/core

To help you get started, we’ve selected a few @uirouter/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ui-router / sticky-states / test / stickySpec.ts View on Github external
beforeEach(function() {
    jasmine.addCustomEqualityTester(equalityTester);
    jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;

    router = new UIRouter();
    router.plugin(servicesPlugin);
    router.plugin(memoryLocationPlugin);
    $stickyState = router.plugin(StickyStatesPlugin);
    router.urlService.rules.otherwise('/');

    // ui-router-core doesn't have a default views builder
    router.stateRegistry.decorator('views', function(state, parentFn) {
      if (isObject(state.views)) {
        return Object.keys(state.views).map(
          key => ({ $name: key, $uiViewName: key, $uiViewContextAnchor: state.name, $type: 'core', $context: state }),
          []
        );
      }

      return [
        {
github ergo / polymer-ui-router / uirouter-mixin.js View on Github external
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

import * as routerCore from '@uirouter/core';
import {dedupingMixin} from '@polymer/polymer/lib/utils/mixin.js';

let uirouter = new routerCore.UIRouter();
uirouter.viewService.uiviewcount = 0;
uirouter.viewService.viewconfigcount = 0;

// Create an internal ViewConfig representation from a state.views object
function viewConfigFactory(pathnodes, viewDeclaration) {
    let config = {
        $id: uirouter.viewService.viewconfigcount++,
        path: pathnodes,
        viewDecl: viewDeclaration,
        loaded: true,
        load: function () {
            return Promise.resolve()
        }
    };

    return [config];
github ui-router / dsr / test / deepStateRedirectSpec.ts View on Github external
beforeEach(async function(done) {
    jasmine.addCustomEqualityTester(equalityTester);
    jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;

    router = new UIRouter();
    router.plugin(servicesPlugin);
    router.plugin(memoryLocationPlugin);
    $deepStateRedirect = router.plugin(DSRPlugin);

    router.urlService.rules.otherwise('/');
    $state = router.stateService;

    testGo = getTestGoFn(router);

    let newStates = getDSRStates();
    dsrReset(newStates);
    newStates.forEach(state => router.stateRegistry.register(state));

    done();
  });