angularjs积累

来源:互联网 发布:日语中文同声翻译软件 编辑:程序博客网 时间:2024/06/05 08:05

注册 ui-router
注入 $stateParams

app.js配置var App = angular.module('app',['ui.router']);App.config(    $state.Provider.state("history"{        url:"/history/:id",        views:{            "":{                templateUrl:"../tpls/history.html",                controller:"historyController"            }        }    ))//controller中使用App.controller("history",function($state,$stateParams){    $state.go('.',{id:1},{reload:true});    console.log($stateParams.id);})//HTML页面中国年使用(跳转到本页面,带参数id=1,刷新页面)<a ui-sref="history({id:1})">跳转到history页面</a>
0 0
原创粉丝点击