Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
angular-translate-loader-url
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Custom Issue Tracker
Custom Issue Tracker
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
angularjs
angular-translate-loader-url
Commits
4784b7d0
Commit
4784b7d0
authored
Aug 03, 2018
by
吕兵川
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] version 2.13.1
parents
Pipeline
#51
failed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
0 deletions
+85
-0
angular-translate-loader-url.js
angular-translate-loader-url.js
+73
-0
bower.json
bower.json
+12
-0
No files found.
angular-translate-loader-url.js
0 → 100644
View file @
4784b7d0
/*!
* angular-translate - v2.13.1 - 2016-12-06
*
* Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT
*/
(
function
(
root
,
factory
)
{
if
(
typeof
define
===
'function'
&&
define
.
amd
)
{
// AMD. Register as an anonymous module unless amdModuleId is set
define
([],
function
()
{
return
(
factory
());
});
}
else
if
(
typeof
exports
===
'object'
)
{
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module
.
exports
=
factory
();
}
else
{
factory
();
}
}(
this
,
function
()
{
$translateUrlLoader
.
$inject
=
[
'$q'
,
'$http'
];
angular
.
module
(
'pascalprecht.translate'
)
/**
* @ngdoc object
* @name pascalprecht.translate.$translateUrlLoader
* @requires $q
* @requires $http
*
* @description
* Creates a loading function for a typical dynamic url pattern:
* "locale.php?lang=en_US", "locale.php?lang=de_DE", "locale.php?language=nl_NL" etc.
* Prefixing the specified url, the current requested, language id will be applied
* with "?{queryParameter}={key}".
* Using this service, the response of these urls must be an object of
* key-value pairs.
*
* @param {object} options Options object, which gets the url, key and
* optional queryParameter ('lang' is used by default).
*/
.
factory
(
'$translateUrlLoader'
,
$translateUrlLoader
);
function
$translateUrlLoader
(
$q
,
$http
)
{
'use strict'
;
return
function
(
options
)
{
if
(
!
options
||
!
options
.
url
)
{
throw
new
Error
(
'Couldn
\'
t use urlLoader since no url is given!'
);
}
var
requestParams
=
{};
requestParams
[
options
.
queryParameter
||
'lang'
]
=
options
.
key
;
return
$http
(
angular
.
extend
({
url
:
options
.
url
,
params
:
requestParams
,
method
:
'GET'
},
options
.
$http
))
.
then
(
function
(
result
)
{
return
result
.
data
;
},
function
()
{
return
$q
.
reject
(
options
.
key
);
});
};
}
$translateUrlLoader
.
displayName
=
'$translateUrlLoader'
;
return
'pascalprecht.translate'
;
}));
bower.json
0 → 100644
View file @
4784b7d0
{
"name"
:
"angular-translate-loader-url"
,
"description"
:
"A plugin for Angular Translate"
,
"version"
:
"2.13.1"
,
"main"
:
"./angular-translate-loader-url.js"
,
"ignore"
:
[],
"author"
:
"Pascal Precht"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"angular-translate"
:
"~2.13.1"
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment