• angular 1.6路由


    angular.js 1.6版本;
    1.实例化:
    var app = angular.module('app',[]).controller('myapp',['$scope',function ($scope){}]);


    2-1.原生路由:


    <a href="#/home"></a>
    <div ng-view></div>
    1> 注入var app = angular.module('app',[ngRouter])
    2> 配置app.config(['$routerProvider','$locationProvider',function($routerProvider,$locationProvider){
    $locationProvider.hashPrefix('');//1.6版本变化;
    $routerProvider
    .when('/index'{
    templateUrl:"./index.html",
    controller:"con"
    })
    .otherwise({redirectTo:"/index"});
    }])


    2-2.ui-router


    ng-view => ui-view
    <a href="#/home"></a>
    <div ui-view></div>
    1> 模块注入:
    var app = angular.module('app',['ui.router']);
    2> 配置路由
    app.config(['$stateProvider','$locationProvider','$urlRouterProvider',function($stateProvider,$locationProvider,$urlRouterProvider){
    $locationProvider.hashPrefix('');
    $urlRouterProvider.otherwise('/index');
    $stateProvider.state('home',{
    url:"/home",
    templateUrl:"./home.html",
    controller:function(){}
    })
    }])
    3.过滤器
    app.filter('test',function(){
    return function(input){
    //code...
    }
    })

  • 相关阅读:
    java.lang.IllegalArgumentException
    JDBC概述
    IntelliJ IDEA15导入jar包
    mySQL基础
    javascript基础
    css基础
    html笔记
    关于intelliJ idea创建servlet提示cannot resolve symbol‘servlet’的问题
    IntelliJ IDEA新建JAVA WEB项目(转载)
    winform 子报表数据源赋值
  • 原文地址:https://www.cnblogs.com/ade-Java/p/6523862.html
Copyright © 2020-2023  润新知