First page Back Continue Last page Graphics
URL Parameters
- URL Parameters can be used to give your user options when running your App. Some Widgets take URL Parameters as well as there are a few global parameters.
- URL Parameters are the “key=value” statements that come after the question mark(?) in the URL.
- Multiple URL parameters can be specified by separating them with an ampersand(&).
- Example: http://localhost/SIMRacingApps/apps/CrewChief?LapsToAverage=1&ALTLAPSTOAVERAGE=0&key=value
- All parameters are placed $scope as attributes by prefixing the key with “sraArgs” and appending the key in uppercase. Converting to upper case is a convention used to identify these variables as parameters from the URL instead of parameters placed in the HTML directly using Camel Case.
- In JavaScript, $scope.sraArgsLAPSTOAVERAGE
- In bound attributes like “data-ng-bind”, sraArgsLAPSTOAVERAGE
- In non-bound HTML, {{sraArgsLAPSTOAVERAGE}}
- It is advisable to initialize the variables in the default.js controller code as follows.
- $scope.sraArgsLAPSTOAVERAGE = $scope.sraArgsLAPSTOAVERAGE || “0”;
- It is not advisable to use special characters in the variable name. But you can put them in the value if you convert them according to URL encoding rules. For example, if you need a space character you would put %20.