Merge pull request #5147 from chrismbarr/patch-7

UI-Router: The templateUrl accepts one parameter
This commit is contained in:
Masahiro Wakame
2015-08-03 22:00:23 +09:00
2 changed files with 14 additions and 7 deletions
+10 -3
View File
@@ -50,7 +50,7 @@ myApp.config((
.state('state1.list', {
url: "/list",
templateUrl: "partials/state1.list.html",
controller: function ($scope: MyAppScope) {
controller: function ($scope: MyAppScope) {
$scope.items = ["A", "List", "Of", "Items"];
}
})
@@ -61,7 +61,7 @@ myApp.config((
.state('state2.list', {
url: "/list",
templateUrl: "partials/state2.list.html",
controller: function ($scope: MyAppScope) {
controller: function ($scope: MyAppScope) {
$scope.things = ["A", "Set", "Of", "Things"];
}
})
@@ -70,7 +70,14 @@ myApp.config((
url: "/list",
templateUrl: "partials/state3.list.html",
controller: function ($scope: MyAppScope) {
$scope.things = ["A", "Set", "Of", "Things"];
$scope.things = ["A", "Set", "Of", "Things"];
}
})
.state('state4', {
url: "/state4",
templateUrl: function($stateParams: ng.ui.IStateParamsService){
//Logic could go here based on $stateParams
return "partials/state4.html";
}
})
.state('index', {
+4 -4
View File
@@ -16,7 +16,7 @@ declare module angular.ui {
/**
* String URL path to template file OR Function, returns URL path string
*/
templateUrl?: string | {(): string};
templateUrl?: string | {(params: IStateParamsService): string};
/**
* Function, returns HTML content string
*/
@@ -53,12 +53,12 @@ declare module angular.ui {
abstract?: boolean;
/**
* Callback function for when a state is entered. Good way to trigger an action or dispatch an event, such as opening a dialog.
* If minifying your scripts, make sure to explictly annotate this function, because it won't be automatically annotated by your build tools.
* If minifying your scripts, make sure to explicitly annotate this function, because it won't be automatically annotated by your build tools.
*/
onEnter?: Function|(string|Function)[];
/**
* Callback functions for when a state is entered and exited. Good way to trigger an action or dispatch an event, such as opening a dialog.
* If minifying your scripts, make sure to explictly annotate this function, because it won't be automatically annotated by your build tools.
* If minifying your scripts, make sure to explicitly annotate this function, because it won't be automatically annotated by your build tools.
*/
onExit?: Function|(string|Function)[];
/**
@@ -66,7 +66,7 @@ declare module angular.ui {
*/
data?: any;
/**
* Boolean (default true). If false will not retrigger the same state just because a search/query parameter has changed. Useful for when you'd like to modify $location.search() without triggering a reload.
* Boolean (default true). If false will not re-trigger the same state just because a search/query parameter has changed. Useful for when you'd like to modify $location.search() without triggering a reload.
*/
reloadOnSearch?: boolean;
}