KEYCLOAK-5127: Exclude node_modules from git (#4334)
* KEYCLOAK-5127: Exclude node_modules from git * Add readme file.
This commit is contained in:
parent
79a64657f7
commit
c8068b688d
539 changed files with 72 additions and 131697 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -49,3 +49,7 @@ target
|
||||||
# Maven shade
|
# Maven shade
|
||||||
#############
|
#############
|
||||||
*dependency-reduced-pom.xml
|
*dependency-reduced-pom.xml
|
||||||
|
|
||||||
|
# nodejs #
|
||||||
|
##########
|
||||||
|
node_modules
|
|
@ -51,4 +51,48 @@
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<filesets>
|
||||||
|
<fileset>
|
||||||
|
<directory>src/main/resources/theme/keycloak/common/resources/node_modules</directory>
|
||||||
|
</fileset>
|
||||||
|
</filesets>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.github.eirslett</groupId>
|
||||||
|
<artifactId>frontend-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>install node and yarn</id>
|
||||||
|
<goals>
|
||||||
|
<goal>install-node-and-yarn</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>generate-resources</phase>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>yarn install</id>
|
||||||
|
<goals>
|
||||||
|
<goal>yarn</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<configuration>
|
||||||
|
<arguments>install --production=false --frozen-lockfile</arguments>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<nodeVersion>v6.11.1</nodeVersion>
|
||||||
|
<yarnVersion>v0.27.5</yarnVersion>
|
||||||
|
<workingDirectory>src/main/resources/theme/keycloak/common/resources</workingDirectory>
|
||||||
|
<installDirectory>target</installDirectory>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
Management of javascript libraries
|
||||||
|
===================================================
|
||||||
|
|
||||||
|
Javascript libraries under the *./lib* directory are not managed. These
|
||||||
|
libraries are not available in the public npm repo and are thus checked into
|
||||||
|
GitHub.
|
||||||
|
|
||||||
|
Javascript libraries under *./node_modules* directory are managed with yarn.
|
||||||
|
THEY SHOULD NOT BE CHECKED INTO GITHUB!
|
||||||
|
|
||||||
|
Adding or Removing javascript libraries
|
||||||
|
---------------------------------------
|
||||||
|
To add/remove/update javascript libraries you should always use yarn so that
|
||||||
|
the yarn.lock file will be updated. Then, just check in the modified version
|
||||||
|
of package.json and yarn.lock. To do this, you should locally install
|
||||||
|
nodejs/npm and yarn.
|
||||||
|
|
||||||
|
Do not use *npm install --save*. If you try to update a dependency using
|
||||||
|
package.json and fail to update yarn.lock, then the next build will fail.
|
||||||
|
|
||||||
|
To locally install nodejs/npm and yarn, see:
|
||||||
|
|
||||||
|
* [Install nodejs and npm](https://www.npmjs.com/get-npm)
|
||||||
|
* [Install yarn](https://yarnpkg.com/lang/en/docs/install/)
|
49
themes/src/main/resources/theme/keycloak/common/resources/node_modules/.yarn-integrity
generated
vendored
49
themes/src/main/resources/theme/keycloak/common/resources/node_modules/.yarn-integrity
generated
vendored
|
@ -1,49 +0,0 @@
|
||||||
{
|
|
||||||
"flags": [],
|
|
||||||
"linkedModules": [],
|
|
||||||
"topLevelPatters": [
|
|
||||||
"angular-cookies@^1.6.4",
|
|
||||||
"angular-loader@^1.6.4",
|
|
||||||
"angular-resource@^1.6.4",
|
|
||||||
"angular-route@^1.6.4",
|
|
||||||
"angular-sanitize@^1.6.4",
|
|
||||||
"angular-translate-loader-url@^2.15.1",
|
|
||||||
"angular-translate@^2.15.1",
|
|
||||||
"angular-treeview@^0.1.5",
|
|
||||||
"angular-ui-select2@^0.0.5",
|
|
||||||
"angular@^1.6.4",
|
|
||||||
"autofill-event@^0.0.1",
|
|
||||||
"bootstrap@^3.3.7",
|
|
||||||
"filesaver@^0.0.13",
|
|
||||||
"font-awesome@^4.7.0",
|
|
||||||
"jquery@^3.2.1",
|
|
||||||
"ng-file-upload@^12.2.13",
|
|
||||||
"select2@3.5.1"
|
|
||||||
],
|
|
||||||
"lockfileEntries": {
|
|
||||||
"angular-cookies@^1.6.4": "https://registry.yarnpkg.com/angular-cookies/-/angular-cookies-1.6.4.tgz#c28f3f6aac7a9826c1e45f1d6807240036e5b26d",
|
|
||||||
"angular-loader@^1.6.4": "https://registry.yarnpkg.com/angular-loader/-/angular-loader-1.6.4.tgz#c202b9dd233b11e66c802f7716c5d82ad249bb42",
|
|
||||||
"angular-resource@^1.6.4": "https://registry.yarnpkg.com/angular-resource/-/angular-resource-1.6.4.tgz#bcb83688b0a7d3402fde58dc7f4881383a6c0ebb",
|
|
||||||
"angular-route@^1.6.4": "https://registry.yarnpkg.com/angular-route/-/angular-route-1.6.4.tgz#7bb216fcda746a1b8c452054b05900a7074ecc62",
|
|
||||||
"angular-sanitize@^1.6.4": "https://registry.yarnpkg.com/angular-sanitize/-/angular-sanitize-1.6.4.tgz#60a37ea96fb0d4a322a3ccb64ee4a5cf3b154f0c",
|
|
||||||
"angular-translate-loader-url@^2.15.1": "https://registry.yarnpkg.com/angular-translate-loader-url/-/angular-translate-loader-url-2.15.1.tgz#31d6785a59d813fe7d8a1990d8be16864ff59e24",
|
|
||||||
"angular-translate@^2.15.1": "https://registry.yarnpkg.com/angular-translate/-/angular-translate-2.15.1.tgz#920f7d2b877819e1c0fa881781b9b675f36480ce",
|
|
||||||
"angular-translate@~2.15.1": "https://registry.yarnpkg.com/angular-translate/-/angular-translate-2.15.1.tgz#920f7d2b877819e1c0fa881781b9b675f36480ce",
|
|
||||||
"angular-treeview@^0.1.5": "https://registry.yarnpkg.com/angular-treeview/-/angular-treeview-0.1.5.tgz#ec797d4d001b20172c983e65d855ebcd8152b4fa",
|
|
||||||
"angular-ui-select2@^0.0.5": "https://registry.yarnpkg.com/angular-ui-select2/-/angular-ui-select2-0.0.5.tgz#15e7643afd69ca9063d405eb3be2f95dd5ec87f5",
|
|
||||||
"angular@>=1.2.26 <=1.6": "https://registry.yarnpkg.com/angular/-/angular-1.6.4.tgz#03b7b15c01a0802d7e2cf593240e604054dc77fb",
|
|
||||||
"angular@^1.6.4": "https://registry.yarnpkg.com/angular/-/angular-1.6.4.tgz#03b7b15c01a0802d7e2cf593240e604054dc77fb",
|
|
||||||
"autofill-event@^0.0.1": "https://registry.yarnpkg.com/autofill-event/-/autofill-event-0.0.1.tgz#c382cf989b21b61ff4a12b3597e1943471d3cf7a",
|
|
||||||
"bootstrap@^3.3.7": "https://registry.yarnpkg.com/bootstrap/-/bootstrap-3.3.7.tgz#5a389394549f23330875a3b150656574f8a9eb71",
|
|
||||||
"filesaver@^0.0.13": "https://registry.yarnpkg.com/filesaver/-/filesaver-0.0.13.tgz#fa9b2ac1371d436fe5edc9285ed998d1e2782bee",
|
|
||||||
"font-awesome@^4.7.0": "https://registry.yarnpkg.com/font-awesome/-/font-awesome-4.7.0.tgz#8fa8cf0411a1a31afd07b06d2902bb9fc815a133",
|
|
||||||
"jquery@^3.2.1": "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787",
|
|
||||||
"minimist@0.0.8": "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d",
|
|
||||||
"mkdirp@^0.5.0": "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903",
|
|
||||||
"ng-file-upload@^12.2.13": "https://registry.yarnpkg.com/ng-file-upload/-/ng-file-upload-12.2.13.tgz#01800f3872e526f95310f8477e99e4f12d0d8d14",
|
|
||||||
"safename@0.0.4": "https://registry.yarnpkg.com/safename/-/safename-0.0.4.tgz#b82c3b6db70d943a0582f9052fbfbfebbb589af5",
|
|
||||||
"select2@3.5.1": "https://registry.yarnpkg.com/select2/-/select2-3.5.1.tgz#f2819489bbc65fd6d328be72bbe2b95dd7e87cfe"
|
|
||||||
},
|
|
||||||
"files": [],
|
|
||||||
"artifacts": {}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2016 Angular
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -1,68 +0,0 @@
|
||||||
# packaged angular-cookies
|
|
||||||
|
|
||||||
This repo is for distribution on `npm` and `bower`. The source for this module is in the
|
|
||||||
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngCookies).
|
|
||||||
Please file issues and pull requests against that repo.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
You can install this package either with `npm` or with `bower`.
|
|
||||||
|
|
||||||
### npm
|
|
||||||
|
|
||||||
```shell
|
|
||||||
npm install angular-cookies
|
|
||||||
```
|
|
||||||
|
|
||||||
Then add `ngCookies` as a dependency for your app:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
angular.module('myApp', [require('angular-cookies')]);
|
|
||||||
```
|
|
||||||
|
|
||||||
### bower
|
|
||||||
|
|
||||||
```shell
|
|
||||||
bower install angular-cookies
|
|
||||||
```
|
|
||||||
|
|
||||||
Add a `<script>` to your `index.html`:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<script src="/bower_components/angular-cookies/angular-cookies.js"></script>
|
|
||||||
```
|
|
||||||
|
|
||||||
Then add `ngCookies` as a dependency for your app:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
angular.module('myApp', ['ngCookies']);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
Documentation is available on the
|
|
||||||
[AngularJS docs site](http://docs.angularjs.org/api/ngCookies).
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
The MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
|
@ -1,331 +0,0 @@
|
||||||
/**
|
|
||||||
* @license AngularJS v1.6.4
|
|
||||||
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
|
||||||
* License: MIT
|
|
||||||
*/
|
|
||||||
(function(window, angular) {'use strict';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc module
|
|
||||||
* @name ngCookies
|
|
||||||
* @description
|
|
||||||
*
|
|
||||||
* # ngCookies
|
|
||||||
*
|
|
||||||
* The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* <div doc-module-components="ngCookies"></div>
|
|
||||||
*
|
|
||||||
* See {@link ngCookies.$cookies `$cookies`} for usage.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
angular.module('ngCookies', ['ng']).
|
|
||||||
info({ angularVersion: '1.6.4' }).
|
|
||||||
/**
|
|
||||||
* @ngdoc provider
|
|
||||||
* @name $cookiesProvider
|
|
||||||
* @description
|
|
||||||
* Use `$cookiesProvider` to change the default behavior of the {@link ngCookies.$cookies $cookies} service.
|
|
||||||
* */
|
|
||||||
provider('$cookies', [/** @this */function $CookiesProvider() {
|
|
||||||
/**
|
|
||||||
* @ngdoc property
|
|
||||||
* @name $cookiesProvider#defaults
|
|
||||||
* @description
|
|
||||||
*
|
|
||||||
* Object containing default options to pass when setting cookies.
|
|
||||||
*
|
|
||||||
* The object may have following properties:
|
|
||||||
*
|
|
||||||
* - **path** - `{string}` - The cookie will be available only for this path and its
|
|
||||||
* sub-paths. By default, this is the URL that appears in your `<base>` tag.
|
|
||||||
* - **domain** - `{string}` - The cookie will be available only for this domain and
|
|
||||||
* its sub-domains. For security reasons the user agent will not accept the cookie
|
|
||||||
* if the current domain is not a sub-domain of this domain or equal to it.
|
|
||||||
* - **expires** - `{string|Date}` - String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT"
|
|
||||||
* or a Date object indicating the exact date/time this cookie will expire.
|
|
||||||
* - **secure** - `{boolean}` - If `true`, then the cookie will only be available through a
|
|
||||||
* secured connection.
|
|
||||||
*
|
|
||||||
* Note: By default, the address that appears in your `<base>` tag will be used as the path.
|
|
||||||
* This is important so that cookies will be visible for all routes when html5mode is enabled.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* angular.module('cookiesProviderExample', ['ngCookies'])
|
|
||||||
* .config(['$cookiesProvider', function($cookiesProvider) {
|
|
||||||
* // Setting default options
|
|
||||||
* $cookiesProvider.defaults.domain = 'foo.com';
|
|
||||||
* $cookiesProvider.defaults.secure = true;
|
|
||||||
* }]);
|
|
||||||
* ```
|
|
||||||
**/
|
|
||||||
var defaults = this.defaults = {};
|
|
||||||
|
|
||||||
function calcOptions(options) {
|
|
||||||
return options ? angular.extend({}, defaults, options) : defaults;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc service
|
|
||||||
* @name $cookies
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Provides read/write access to browser's cookies.
|
|
||||||
*
|
|
||||||
* <div class="alert alert-info">
|
|
||||||
* Up until Angular 1.3, `$cookies` exposed properties that represented the
|
|
||||||
* current browser cookie values. In version 1.4, this behavior has changed, and
|
|
||||||
* `$cookies` now provides a standard api of getters, setters etc.
|
|
||||||
* </div>
|
|
||||||
*
|
|
||||||
* Requires the {@link ngCookies `ngCookies`} module to be installed.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* angular.module('cookiesExample', ['ngCookies'])
|
|
||||||
* .controller('ExampleController', ['$cookies', function($cookies) {
|
|
||||||
* // Retrieving a cookie
|
|
||||||
* var favoriteCookie = $cookies.get('myFavorite');
|
|
||||||
* // Setting a cookie
|
|
||||||
* $cookies.put('myFavorite', 'oatmeal');
|
|
||||||
* }]);
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
this.$get = ['$$cookieReader', '$$cookieWriter', function($$cookieReader, $$cookieWriter) {
|
|
||||||
return {
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name $cookies#get
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Returns the value of given cookie key
|
|
||||||
*
|
|
||||||
* @param {string} key Id to use for lookup.
|
|
||||||
* @returns {string} Raw cookie value.
|
|
||||||
*/
|
|
||||||
get: function(key) {
|
|
||||||
return $$cookieReader()[key];
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name $cookies#getObject
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Returns the deserialized value of given cookie key
|
|
||||||
*
|
|
||||||
* @param {string} key Id to use for lookup.
|
|
||||||
* @returns {Object} Deserialized cookie value.
|
|
||||||
*/
|
|
||||||
getObject: function(key) {
|
|
||||||
var value = this.get(key);
|
|
||||||
return value ? angular.fromJson(value) : value;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name $cookies#getAll
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Returns a key value object with all the cookies
|
|
||||||
*
|
|
||||||
* @returns {Object} All cookies
|
|
||||||
*/
|
|
||||||
getAll: function() {
|
|
||||||
return $$cookieReader();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name $cookies#put
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Sets a value for given cookie key
|
|
||||||
*
|
|
||||||
* @param {string} key Id for the `value`.
|
|
||||||
* @param {string} value Raw value to be stored.
|
|
||||||
* @param {Object=} options Options object.
|
|
||||||
* See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
|
|
||||||
*/
|
|
||||||
put: function(key, value, options) {
|
|
||||||
$$cookieWriter(key, value, calcOptions(options));
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name $cookies#putObject
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Serializes and sets a value for given cookie key
|
|
||||||
*
|
|
||||||
* @param {string} key Id for the `value`.
|
|
||||||
* @param {Object} value Value to be stored.
|
|
||||||
* @param {Object=} options Options object.
|
|
||||||
* See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
|
|
||||||
*/
|
|
||||||
putObject: function(key, value, options) {
|
|
||||||
this.put(key, angular.toJson(value), options);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name $cookies#remove
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Remove given cookie
|
|
||||||
*
|
|
||||||
* @param {string} key Id of the key-value pair to delete.
|
|
||||||
* @param {Object=} options Options object.
|
|
||||||
* See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
|
|
||||||
*/
|
|
||||||
remove: function(key, options) {
|
|
||||||
$$cookieWriter(key, undefined, calcOptions(options));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
}]);
|
|
||||||
|
|
||||||
angular.module('ngCookies').
|
|
||||||
/**
|
|
||||||
* @ngdoc service
|
|
||||||
* @name $cookieStore
|
|
||||||
* @deprecated
|
|
||||||
* sinceVersion="v1.4.0"
|
|
||||||
* Please use the {@link ngCookies.$cookies `$cookies`} service instead.
|
|
||||||
*
|
|
||||||
* @requires $cookies
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Provides a key-value (string-object) storage, that is backed by session cookies.
|
|
||||||
* Objects put or retrieved from this storage are automatically serialized or
|
|
||||||
* deserialized by angular's toJson/fromJson.
|
|
||||||
*
|
|
||||||
* Requires the {@link ngCookies `ngCookies`} module to be installed.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* angular.module('cookieStoreExample', ['ngCookies'])
|
|
||||||
* .controller('ExampleController', ['$cookieStore', function($cookieStore) {
|
|
||||||
* // Put cookie
|
|
||||||
* $cookieStore.put('myFavorite','oatmeal');
|
|
||||||
* // Get cookie
|
|
||||||
* var favoriteCookie = $cookieStore.get('myFavorite');
|
|
||||||
* // Removing a cookie
|
|
||||||
* $cookieStore.remove('myFavorite');
|
|
||||||
* }]);
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
factory('$cookieStore', ['$cookies', function($cookies) {
|
|
||||||
|
|
||||||
return {
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name $cookieStore#get
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Returns the value of given cookie key
|
|
||||||
*
|
|
||||||
* @param {string} key Id to use for lookup.
|
|
||||||
* @returns {Object} Deserialized cookie value, undefined if the cookie does not exist.
|
|
||||||
*/
|
|
||||||
get: function(key) {
|
|
||||||
return $cookies.getObject(key);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name $cookieStore#put
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Sets a value for given cookie key
|
|
||||||
*
|
|
||||||
* @param {string} key Id for the `value`.
|
|
||||||
* @param {Object} value Value to be stored.
|
|
||||||
*/
|
|
||||||
put: function(key, value) {
|
|
||||||
$cookies.putObject(key, value);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name $cookieStore#remove
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Remove given cookie
|
|
||||||
*
|
|
||||||
* @param {string} key Id of the key-value pair to delete.
|
|
||||||
*/
|
|
||||||
remove: function(key) {
|
|
||||||
$cookies.remove(key);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name $$cookieWriter
|
|
||||||
* @requires $document
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* This is a private service for writing cookies
|
|
||||||
*
|
|
||||||
* @param {string} name Cookie name
|
|
||||||
* @param {string=} value Cookie value (if undefined, cookie will be deleted)
|
|
||||||
* @param {Object=} options Object with options that need to be stored for the cookie.
|
|
||||||
*/
|
|
||||||
function $$CookieWriter($document, $log, $browser) {
|
|
||||||
var cookiePath = $browser.baseHref();
|
|
||||||
var rawDocument = $document[0];
|
|
||||||
|
|
||||||
function buildCookieString(name, value, options) {
|
|
||||||
var path, expires;
|
|
||||||
options = options || {};
|
|
||||||
expires = options.expires;
|
|
||||||
path = angular.isDefined(options.path) ? options.path : cookiePath;
|
|
||||||
if (angular.isUndefined(value)) {
|
|
||||||
expires = 'Thu, 01 Jan 1970 00:00:00 GMT';
|
|
||||||
value = '';
|
|
||||||
}
|
|
||||||
if (angular.isString(expires)) {
|
|
||||||
expires = new Date(expires);
|
|
||||||
}
|
|
||||||
|
|
||||||
var str = encodeURIComponent(name) + '=' + encodeURIComponent(value);
|
|
||||||
str += path ? ';path=' + path : '';
|
|
||||||
str += options.domain ? ';domain=' + options.domain : '';
|
|
||||||
str += expires ? ';expires=' + expires.toUTCString() : '';
|
|
||||||
str += options.secure ? ';secure' : '';
|
|
||||||
|
|
||||||
// per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
|
|
||||||
// - 300 cookies
|
|
||||||
// - 20 cookies per unique domain
|
|
||||||
// - 4096 bytes per cookie
|
|
||||||
var cookieLength = str.length + 1;
|
|
||||||
if (cookieLength > 4096) {
|
|
||||||
$log.warn('Cookie \'' + name +
|
|
||||||
'\' possibly not set or overflowed because it was too large (' +
|
|
||||||
cookieLength + ' > 4096 bytes)!');
|
|
||||||
}
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
return function(name, value, options) {
|
|
||||||
rawDocument.cookie = buildCookieString(name, value, options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
$$CookieWriter.$inject = ['$document', '$log', '$browser'];
|
|
||||||
|
|
||||||
angular.module('ngCookies').provider('$$cookieWriter', /** @this */ function $$CookieWriterProvider() {
|
|
||||||
this.$get = $$CookieWriter;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
})(window, window.angular);
|
|
|
@ -1,9 +0,0 @@
|
||||||
/*
|
|
||||||
AngularJS v1.6.4
|
|
||||||
(c) 2010-2017 Google, Inc. http://angularjs.org
|
|
||||||
License: MIT
|
|
||||||
*/
|
|
||||||
(function(n,c){'use strict';function l(b,a,g){var d=g.baseHref(),k=b[0];return function(b,e,f){var g,h;f=f||{};h=f.expires;g=c.isDefined(f.path)?f.path:d;c.isUndefined(e)&&(h="Thu, 01 Jan 1970 00:00:00 GMT",e="");c.isString(h)&&(h=new Date(h));e=encodeURIComponent(b)+"="+encodeURIComponent(e);e=e+(g?";path="+g:"")+(f.domain?";domain="+f.domain:"");e+=h?";expires="+h.toUTCString():"";e+=f.secure?";secure":"";f=e.length+1;4096<f&&a.warn("Cookie '"+b+"' possibly not set or overflowed because it was too large ("+
|
|
||||||
f+" > 4096 bytes)!");k.cookie=e}}c.module("ngCookies",["ng"]).info({angularVersion:"1.6.4"}).provider("$cookies",[function(){var b=this.defaults={};this.$get=["$$cookieReader","$$cookieWriter",function(a,g){return{get:function(d){return a()[d]},getObject:function(d){return(d=this.get(d))?c.fromJson(d):d},getAll:function(){return a()},put:function(d,a,m){g(d,a,m?c.extend({},b,m):b)},putObject:function(d,b,a){this.put(d,c.toJson(b),a)},remove:function(a,k){g(a,void 0,k?c.extend({},b,k):b)}}}]}]);c.module("ngCookies").factory("$cookieStore",
|
|
||||||
["$cookies",function(b){return{get:function(a){return b.getObject(a)},put:function(a,c){b.putObject(a,c)},remove:function(a){b.remove(a)}}}]);l.$inject=["$document","$log","$browser"];c.module("ngCookies").provider("$$cookieWriter",function(){this.$get=l})})(window,window.angular);
|
|
||||||
//# sourceMappingURL=angular-cookies.min.js.map
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"version":3,
|
|
||||||
"file":"angular-cookies.min.js",
|
|
||||||
"lineCount":8,
|
|
||||||
"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkB,CAoR3BC,QAASA,EAAc,CAACC,CAAD,CAAYC,CAAZ,CAAkBC,CAAlB,CAA4B,CACjD,IAAIC,EAAaD,CAAAE,SAAA,EAAjB,CACIC,EAAcL,CAAA,CAAU,CAAV,CAmClB,OAAO,SAAQ,CAACM,CAAD,CAAOC,CAAP,CAAcC,CAAd,CAAuB,CAjCW,IAC3CC,CAD2C,CACrCC,CACVF,EAAA,CAgCoDA,CAhCpD,EAAqB,EACrBE,EAAA,CAAUF,CAAAE,QACVD,EAAA,CAAOX,CAAAa,UAAA,CAAkBH,CAAAC,KAAlB,CAAA,CAAkCD,CAAAC,KAAlC,CAAiDN,CACpDL,EAAAc,YAAA,CAAoBL,CAApB,CAAJ,GACEG,CACA,CADU,+BACV,CAAAH,CAAA,CAAQ,EAFV,CAIIT,EAAAe,SAAA,CAAiBH,CAAjB,CAAJ,GACEA,CADF,CACY,IAAII,IAAJ,CAASJ,CAAT,CADZ,CAIIK,EAAAA,CAAMC,kBAAA,CAqB6BV,CArB7B,CAANS,CAAiC,GAAjCA,CAAuCC,kBAAA,CAAmBT,CAAnB,CAE3CQ,EAAA,CADAA,CACA,EADON,CAAA,CAAO,QAAP,CAAkBA,CAAlB,CAAyB,EAChC,GAAOD,CAAAS,OAAA,CAAiB,UAAjB,CAA8BT,CAAAS,OAA9B,CAA+C,EAAtD,CACAF,EAAA,EAAOL,CAAA,CAAU,WAAV,CAAwBA,CAAAQ,YAAA,EAAxB,CAAgD,EACvDH,EAAA,EAAOP,CAAAW,OAAA,CAAiB,SAAjB,CAA6B,EAMhCC,EAAAA,CAAeL,CAAAM,OAAfD,CAA4B,CACb,KAAnB,CAAIA,CAAJ,EACEnB,CAAAqB,KAAA,CAAU,UAAV,CASqChB,CATrC,CACE,6DADF;AAEEc,CAFF,CAEiB,iBAFjB,CASFf,EAAAkB,OAAA,CAJOR,CAG6B,CArCW,CAlQnDjB,CAAA0B,OAAA,CAAe,WAAf,CAA4B,CAAC,IAAD,CAA5B,CAAAC,KAAA,CACO,CAAEC,eAAgB,OAAlB,CADP,CAAAC,SAAA,CAQY,UARZ,CAQwB,CAAaC,QAAyB,EAAG,CAkC7D,IAAIC,EAAW,IAAAA,SAAXA,CAA2B,EAiC/B,KAAAC,KAAA,CAAY,CAAC,gBAAD,CAAmB,gBAAnB,CAAqC,QAAQ,CAACC,CAAD,CAAiBC,CAAjB,CAAiC,CACxF,MAAO,CAWLC,IAAKA,QAAQ,CAACC,CAAD,CAAM,CACjB,MAAOH,EAAA,EAAA,CAAiBG,CAAjB,CADU,CAXd,CAyBLC,UAAWA,QAAQ,CAACD,CAAD,CAAM,CAEvB,MAAO,CADH3B,CACG,CADK,IAAA0B,IAAA,CAASC,CAAT,CACL,EAAQpC,CAAAsC,SAAA,CAAiB7B,CAAjB,CAAR,CAAkCA,CAFlB,CAzBpB,CAuCL8B,OAAQA,QAAQ,EAAG,CACjB,MAAON,EAAA,EADU,CAvCd,CAuDLO,IAAKA,QAAQ,CAACJ,CAAD,CAAM3B,CAAN,CAAaC,CAAb,CAAsB,CACjCwB,CAAA,CAAeE,CAAf,CAAoB3B,CAApB,CAAuCC,CAvFpC,CAAUV,CAAAyC,OAAA,CAAe,EAAf,CAAmBV,CAAnB,CAuF0BrB,CAvF1B,CAAV,CAAkDqB,CAuFrD,CADiC,CAvD9B,CAuELW,UAAWA,QAAQ,CAACN,CAAD,CAAM3B,CAAN,CAAaC,CAAb,CAAsB,CACvC,IAAA8B,IAAA,CAASJ,CAAT,CAAcpC,CAAA2C,OAAA,CAAelC,CAAf,CAAd,CAAqCC,CAArC,CADuC,CAvEpC,CAsFLkC,OAAQA,QAAQ,CAACR,CAAD,CAAM1B,CAAN,CAAe,CAC7BwB,CAAA,CAAeE,CAAf,CAAoBS,IAAAA,EAApB,CAA2CnC,CAtHxC,CAAUV,CAAAyC,OAAA,CAAe,EAAf,CAAmBV,CAAnB,CAsH8BrB,CAtH9B,CAAV,CAAkDqB,CAsHrD,CAD6B,CAtF1B,CADiF,CAA9E,CAnEiD,CAAzC,CARxB,CAyKA/B,EAAA0B,OAAA,CAAe,WAAf,CAAAoB,QAAA,CA+BS,cA/BT;AA+ByB,CAAC,UAAD,CAAa,QAAQ,CAACC,CAAD,CAAW,CAErD,MAAO,CAWLZ,IAAKA,QAAQ,CAACC,CAAD,CAAM,CACjB,MAAOW,EAAAV,UAAA,CAAmBD,CAAnB,CADU,CAXd,CAyBLI,IAAKA,QAAQ,CAACJ,CAAD,CAAM3B,CAAN,CAAa,CACxBsC,CAAAL,UAAA,CAAmBN,CAAnB,CAAwB3B,CAAxB,CADwB,CAzBrB,CAsCLmC,OAAQA,QAAQ,CAACR,CAAD,CAAM,CACpBW,CAAAH,OAAA,CAAgBR,CAAhB,CADoB,CAtCjB,CAF8C,CAAhC,CA/BzB,CAmIAnC,EAAA+C,QAAA,CAAyB,CAAC,WAAD,CAAc,MAAd,CAAsB,UAAtB,CAEzBhD,EAAA0B,OAAA,CAAe,WAAf,CAAAG,SAAA,CAAqC,gBAArC,CAAoEoB,QAA+B,EAAG,CACpG,IAAAjB,KAAA,CAAY/B,CADwF,CAAtG,CAhU2B,CAA1B,CAAD,CAqUGF,MArUH,CAqUWA,MAAAC,QArUX;",
|
|
||||||
"sources":["angular-cookies.js"],
|
|
||||||
"names":["window","angular","$$CookieWriter","$document","$log","$browser","cookiePath","baseHref","rawDocument","name","value","options","path","expires","isDefined","isUndefined","isString","Date","str","encodeURIComponent","domain","toUTCString","secure","cookieLength","length","warn","cookie","module","info","angularVersion","provider","$CookiesProvider","defaults","$get","$$cookieReader","$$cookieWriter","get","key","getObject","fromJson","getAll","put","extend","putObject","toJson","remove","undefined","factory","$cookies","$inject","$$CookieWriterProvider"]
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-cookies",
|
|
||||||
"version": "1.6.4",
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "./angular-cookies.js",
|
|
||||||
"ignore": [],
|
|
||||||
"dependencies": {
|
|
||||||
"angular": "1.6.4"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
require('./angular-cookies');
|
|
||||||
module.exports = 'ngCookies';
|
|
|
@ -1,33 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-cookies",
|
|
||||||
"version": "1.6.4",
|
|
||||||
"description": "AngularJS module for cookies",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/angular/angular.js.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"angular",
|
|
||||||
"framework",
|
|
||||||
"browser",
|
|
||||||
"cookies",
|
|
||||||
"client-side"
|
|
||||||
],
|
|
||||||
"author": "Angular Core Team <angular-core+npm@google.com>",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/angular/angular.js/issues"
|
|
||||||
},
|
|
||||||
"homepage": "http://angularjs.org",
|
|
||||||
"jspm": {
|
|
||||||
"shim": {
|
|
||||||
"angular-cookies": {
|
|
||||||
"deps": ["angular"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2016 Angular
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -1,65 +0,0 @@
|
||||||
# packaged angular-loader
|
|
||||||
|
|
||||||
This repo is for distribution on `npm` and `bower`. The source for this module is in the
|
|
||||||
[main AngularJS repo](https://github.com/angular/angular.js/blob/master/src/loader.js).
|
|
||||||
Please file issues and pull requests against that repo.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
You can install this package either with `npm` or with `bower`.
|
|
||||||
|
|
||||||
### npm
|
|
||||||
|
|
||||||
```shell
|
|
||||||
npm install angular-loader
|
|
||||||
```
|
|
||||||
|
|
||||||
Add a `<script>` to your `index.html`:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<script src="/node_modules/angular-loader/angular-loader.js"></script>
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that this package is not in CommonJS format, so doing `require('angular-loader')` will
|
|
||||||
return `undefined`.
|
|
||||||
|
|
||||||
### bower
|
|
||||||
|
|
||||||
```shell
|
|
||||||
bower install angular-loader
|
|
||||||
```
|
|
||||||
|
|
||||||
Add a `<script>` to your `index.html`:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<script src="/bower_components/angular-loader/angular-loader.js"></script>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
Documentation is available on the
|
|
||||||
[AngularJS docs site](http://docs.angularjs.org/guide/bootstrap).
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
The MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
|
@ -1,533 +0,0 @@
|
||||||
/**
|
|
||||||
* @license AngularJS v1.6.4
|
|
||||||
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
|
||||||
* License: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function() {'use strict';
|
|
||||||
function isFunction(value) {return typeof value === 'function';}
|
|
||||||
function isDefined(value) {return typeof value !== 'undefined';}
|
|
||||||
function isObject(value) {return value !== null && typeof value === 'object';}
|
|
||||||
|
|
||||||
/* global toDebugString: true */
|
|
||||||
|
|
||||||
function serializeObject(obj, maxDepth) {
|
|
||||||
var seen = [];
|
|
||||||
|
|
||||||
// There is no direct way to stringify object until reaching a specific depth
|
|
||||||
// and a very deep object can cause a performance issue, so we copy the object
|
|
||||||
// based on this specific depth and then stringify it.
|
|
||||||
if (isValidObjectMaxDepth(maxDepth)) {
|
|
||||||
obj = copy(obj, null, maxDepth);
|
|
||||||
}
|
|
||||||
return JSON.stringify(obj, function(key, val) {
|
|
||||||
val = toJsonReplacer(key, val);
|
|
||||||
if (isObject(val)) {
|
|
||||||
|
|
||||||
if (seen.indexOf(val) >= 0) return '...';
|
|
||||||
|
|
||||||
seen.push(val);
|
|
||||||
}
|
|
||||||
return val;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function toDebugString(obj, maxDepth) {
|
|
||||||
if (typeof obj === 'function') {
|
|
||||||
return obj.toString().replace(/ \{[\s\S]*$/, '');
|
|
||||||
} else if (isUndefined(obj)) {
|
|
||||||
return 'undefined';
|
|
||||||
} else if (typeof obj !== 'string') {
|
|
||||||
return serializeObject(obj, maxDepth);
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description
|
|
||||||
*
|
|
||||||
* This object provides a utility for producing rich Error messages within
|
|
||||||
* Angular. It can be called as follows:
|
|
||||||
*
|
|
||||||
* var exampleMinErr = minErr('example');
|
|
||||||
* throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
|
|
||||||
*
|
|
||||||
* The above creates an instance of minErr in the example namespace. The
|
|
||||||
* resulting error will have a namespaced error code of example.one. The
|
|
||||||
* resulting error will replace {0} with the value of foo, and {1} with the
|
|
||||||
* value of bar. The object is not restricted in the number of arguments it can
|
|
||||||
* take.
|
|
||||||
*
|
|
||||||
* If fewer arguments are specified than necessary for interpolation, the extra
|
|
||||||
* interpolation markers will be preserved in the final string.
|
|
||||||
*
|
|
||||||
* Since data will be parsed statically during a build step, some restrictions
|
|
||||||
* are applied with respect to how minErr instances are created and called.
|
|
||||||
* Instances should have names of the form namespaceMinErr for a minErr created
|
|
||||||
* using minErr('namespace') . Error codes, namespaces and template strings
|
|
||||||
* should all be static strings, not variables or general expressions.
|
|
||||||
*
|
|
||||||
* @param {string} module The namespace to use for the new minErr instance.
|
|
||||||
* @param {function} ErrorConstructor Custom error constructor to be instantiated when returning
|
|
||||||
* error from returned function, for cases when a particular type of error is useful.
|
|
||||||
* @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
|
|
||||||
*/
|
|
||||||
|
|
||||||
function minErr(module, ErrorConstructor) {
|
|
||||||
ErrorConstructor = ErrorConstructor || Error;
|
|
||||||
return function() {
|
|
||||||
var code = arguments[0],
|
|
||||||
template = arguments[1],
|
|
||||||
message = '[' + (module ? module + ':' : '') + code + '] ',
|
|
||||||
templateArgs = sliceArgs(arguments, 2).map(function(arg) {
|
|
||||||
return toDebugString(arg, minErrConfig.objectMaxDepth);
|
|
||||||
}),
|
|
||||||
paramPrefix, i;
|
|
||||||
|
|
||||||
message += template.replace(/\{\d+\}/g, function(match) {
|
|
||||||
var index = +match.slice(1, -1);
|
|
||||||
|
|
||||||
if (index < templateArgs.length) {
|
|
||||||
return templateArgs[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
return match;
|
|
||||||
});
|
|
||||||
|
|
||||||
message += '\nhttp://errors.angularjs.org/1.6.4/' +
|
|
||||||
(module ? module + '/' : '') + code;
|
|
||||||
|
|
||||||
for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
|
|
||||||
message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ErrorConstructor(message);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc type
|
|
||||||
* @name angular.Module
|
|
||||||
* @module ng
|
|
||||||
* @description
|
|
||||||
*
|
|
||||||
* Interface for configuring angular {@link angular.module modules}.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function setupModuleLoader(window) {
|
|
||||||
|
|
||||||
var $injectorMinErr = minErr('$injector');
|
|
||||||
var ngMinErr = minErr('ng');
|
|
||||||
|
|
||||||
function ensure(obj, name, factory) {
|
|
||||||
return obj[name] || (obj[name] = factory());
|
|
||||||
}
|
|
||||||
|
|
||||||
var angular = ensure(window, 'angular', Object);
|
|
||||||
|
|
||||||
// We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
|
|
||||||
angular.$$minErr = angular.$$minErr || minErr;
|
|
||||||
|
|
||||||
return ensure(angular, 'module', function() {
|
|
||||||
/** @type {Object.<string, angular.Module>} */
|
|
||||||
var modules = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name angular.module
|
|
||||||
* @module ng
|
|
||||||
* @description
|
|
||||||
*
|
|
||||||
* The `angular.module` is a global place for creating, registering and retrieving Angular
|
|
||||||
* modules.
|
|
||||||
* All modules (angular core or 3rd party) that should be available to an application must be
|
|
||||||
* registered using this mechanism.
|
|
||||||
*
|
|
||||||
* Passing one argument retrieves an existing {@link angular.Module},
|
|
||||||
* whereas passing more than one argument creates a new {@link angular.Module}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* # Module
|
|
||||||
*
|
|
||||||
* A module is a collection of services, directives, controllers, filters, and configuration information.
|
|
||||||
* `angular.module` is used to configure the {@link auto.$injector $injector}.
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* // Create a new module
|
|
||||||
* var myModule = angular.module('myModule', []);
|
|
||||||
*
|
|
||||||
* // register a new service
|
|
||||||
* myModule.value('appName', 'MyCoolApp');
|
|
||||||
*
|
|
||||||
* // configure existing services inside initialization blocks.
|
|
||||||
* myModule.config(['$locationProvider', function($locationProvider) {
|
|
||||||
* // Configure existing providers
|
|
||||||
* $locationProvider.hashPrefix('!');
|
|
||||||
* }]);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Then you can create an injector and load your modules like this:
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* var injector = angular.injector(['ng', 'myModule'])
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* However it's more likely that you'll just use
|
|
||||||
* {@link ng.directive:ngApp ngApp} or
|
|
||||||
* {@link angular.bootstrap} to simplify this process for you.
|
|
||||||
*
|
|
||||||
* @param {!string} name The name of the module to create or retrieve.
|
|
||||||
* @param {!Array.<string>=} requires If specified then new module is being created. If
|
|
||||||
* unspecified then the module is being retrieved for further configuration.
|
|
||||||
* @param {Function=} configFn Optional configuration function for the module. Same as
|
|
||||||
* {@link angular.Module#config Module#config()}.
|
|
||||||
* @returns {angular.Module} new module with the {@link angular.Module} api.
|
|
||||||
*/
|
|
||||||
return function module(name, requires, configFn) {
|
|
||||||
|
|
||||||
var info = {};
|
|
||||||
|
|
||||||
var assertNotHasOwnProperty = function(name, context) {
|
|
||||||
if (name === 'hasOwnProperty') {
|
|
||||||
throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
assertNotHasOwnProperty(name, 'module');
|
|
||||||
if (requires && modules.hasOwnProperty(name)) {
|
|
||||||
modules[name] = null;
|
|
||||||
}
|
|
||||||
return ensure(modules, name, function() {
|
|
||||||
if (!requires) {
|
|
||||||
throw $injectorMinErr('nomod', 'Module \'{0}\' is not available! You either misspelled ' +
|
|
||||||
'the module name or forgot to load it. If registering a module ensure that you ' +
|
|
||||||
'specify the dependencies as the second argument.', name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @type {!Array.<Array.<*>>} */
|
|
||||||
var invokeQueue = [];
|
|
||||||
|
|
||||||
/** @type {!Array.<Function>} */
|
|
||||||
var configBlocks = [];
|
|
||||||
|
|
||||||
/** @type {!Array.<Function>} */
|
|
||||||
var runBlocks = [];
|
|
||||||
|
|
||||||
var config = invokeLater('$injector', 'invoke', 'push', configBlocks);
|
|
||||||
|
|
||||||
/** @type {angular.Module} */
|
|
||||||
var moduleInstance = {
|
|
||||||
// Private state
|
|
||||||
_invokeQueue: invokeQueue,
|
|
||||||
_configBlocks: configBlocks,
|
|
||||||
_runBlocks: runBlocks,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#info
|
|
||||||
* @module ng
|
|
||||||
*
|
|
||||||
* @param {Object=} info Information about the module
|
|
||||||
* @returns {Object|Module} The current info object for this module if called as a getter,
|
|
||||||
* or `this` if called as a setter.
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Read and write custom information about this module.
|
|
||||||
* For example you could put the version of the module in here.
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* angular.module('myModule', []).info({ version: '1.0.0' });
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* The version could then be read back out by accessing the module elsewhere:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* var version = angular.module('myModule').info().version;
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* You can also retrieve this information during runtime via the
|
|
||||||
* {@link $injector#modules `$injector.modules`} property:
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* var version = $injector.modules['myModule'].info().version;
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
info: function(value) {
|
|
||||||
if (isDefined(value)) {
|
|
||||||
if (!isObject(value)) throw ngMinErr('aobj', 'Argument \'{0}\' must be an object', 'value');
|
|
||||||
info = value;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc property
|
|
||||||
* @name angular.Module#requires
|
|
||||||
* @module ng
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Holds the list of modules which the injector will load before the current module is
|
|
||||||
* loaded.
|
|
||||||
*/
|
|
||||||
requires: requires,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc property
|
|
||||||
* @name angular.Module#name
|
|
||||||
* @module ng
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Name of the module.
|
|
||||||
*/
|
|
||||||
name: name,
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#provider
|
|
||||||
* @module ng
|
|
||||||
* @param {string} name service name
|
|
||||||
* @param {Function} providerType Construction function for creating new instance of the
|
|
||||||
* service.
|
|
||||||
* @description
|
|
||||||
* See {@link auto.$provide#provider $provide.provider()}.
|
|
||||||
*/
|
|
||||||
provider: invokeLaterAndSetModuleName('$provide', 'provider'),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#factory
|
|
||||||
* @module ng
|
|
||||||
* @param {string} name service name
|
|
||||||
* @param {Function} providerFunction Function for creating new instance of the service.
|
|
||||||
* @description
|
|
||||||
* See {@link auto.$provide#factory $provide.factory()}.
|
|
||||||
*/
|
|
||||||
factory: invokeLaterAndSetModuleName('$provide', 'factory'),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#service
|
|
||||||
* @module ng
|
|
||||||
* @param {string} name service name
|
|
||||||
* @param {Function} constructor A constructor function that will be instantiated.
|
|
||||||
* @description
|
|
||||||
* See {@link auto.$provide#service $provide.service()}.
|
|
||||||
*/
|
|
||||||
service: invokeLaterAndSetModuleName('$provide', 'service'),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#value
|
|
||||||
* @module ng
|
|
||||||
* @param {string} name service name
|
|
||||||
* @param {*} object Service instance object.
|
|
||||||
* @description
|
|
||||||
* See {@link auto.$provide#value $provide.value()}.
|
|
||||||
*/
|
|
||||||
value: invokeLater('$provide', 'value'),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#constant
|
|
||||||
* @module ng
|
|
||||||
* @param {string} name constant name
|
|
||||||
* @param {*} object Constant value.
|
|
||||||
* @description
|
|
||||||
* Because the constants are fixed, they get applied before other provide methods.
|
|
||||||
* See {@link auto.$provide#constant $provide.constant()}.
|
|
||||||
*/
|
|
||||||
constant: invokeLater('$provide', 'constant', 'unshift'),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#decorator
|
|
||||||
* @module ng
|
|
||||||
* @param {string} name The name of the service to decorate.
|
|
||||||
* @param {Function} decorFn This function will be invoked when the service needs to be
|
|
||||||
* instantiated and should return the decorated service instance.
|
|
||||||
* @description
|
|
||||||
* See {@link auto.$provide#decorator $provide.decorator()}.
|
|
||||||
*/
|
|
||||||
decorator: invokeLaterAndSetModuleName('$provide', 'decorator', configBlocks),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#animation
|
|
||||||
* @module ng
|
|
||||||
* @param {string} name animation name
|
|
||||||
* @param {Function} animationFactory Factory function for creating new instance of an
|
|
||||||
* animation.
|
|
||||||
* @description
|
|
||||||
*
|
|
||||||
* **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Defines an animation hook that can be later used with
|
|
||||||
* {@link $animate $animate} service and directives that use this service.
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* module.animation('.animation-name', function($inject1, $inject2) {
|
|
||||||
* return {
|
|
||||||
* eventName : function(element, done) {
|
|
||||||
* //code to run the animation
|
|
||||||
* //once complete, then run done()
|
|
||||||
* return function cancellationFunction(element) {
|
|
||||||
* //code to cancel the animation
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* })
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* See {@link ng.$animateProvider#register $animateProvider.register()} and
|
|
||||||
* {@link ngAnimate ngAnimate module} for more information.
|
|
||||||
*/
|
|
||||||
animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#filter
|
|
||||||
* @module ng
|
|
||||||
* @param {string} name Filter name - this must be a valid angular expression identifier
|
|
||||||
* @param {Function} filterFactory Factory function for creating new instance of filter.
|
|
||||||
* @description
|
|
||||||
* See {@link ng.$filterProvider#register $filterProvider.register()}.
|
|
||||||
*
|
|
||||||
* <div class="alert alert-warning">
|
|
||||||
* **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
|
|
||||||
* Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
|
|
||||||
* your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
|
|
||||||
* (`myapp_subsection_filterx`).
|
|
||||||
* </div>
|
|
||||||
*/
|
|
||||||
filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#controller
|
|
||||||
* @module ng
|
|
||||||
* @param {string|Object} name Controller name, or an object map of controllers where the
|
|
||||||
* keys are the names and the values are the constructors.
|
|
||||||
* @param {Function} constructor Controller constructor function.
|
|
||||||
* @description
|
|
||||||
* See {@link ng.$controllerProvider#register $controllerProvider.register()}.
|
|
||||||
*/
|
|
||||||
controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#directive
|
|
||||||
* @module ng
|
|
||||||
* @param {string|Object} name Directive name, or an object map of directives where the
|
|
||||||
* keys are the names and the values are the factories.
|
|
||||||
* @param {Function} directiveFactory Factory function for creating new instance of
|
|
||||||
* directives.
|
|
||||||
* @description
|
|
||||||
* See {@link ng.$compileProvider#directive $compileProvider.directive()}.
|
|
||||||
*/
|
|
||||||
directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#component
|
|
||||||
* @module ng
|
|
||||||
* @param {string} name Name of the component in camel-case (i.e. myComp which will match as my-comp)
|
|
||||||
* @param {Object} options Component definition object (a simplified
|
|
||||||
* {@link ng.$compile#directive-definition-object directive definition object})
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* See {@link ng.$compileProvider#component $compileProvider.component()}.
|
|
||||||
*/
|
|
||||||
component: invokeLaterAndSetModuleName('$compileProvider', 'component'),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#config
|
|
||||||
* @module ng
|
|
||||||
* @param {Function} configFn Execute this function on module load. Useful for service
|
|
||||||
* configuration.
|
|
||||||
* @description
|
|
||||||
* Use this method to register work which needs to be performed on module loading.
|
|
||||||
* For more about how to configure services, see
|
|
||||||
* {@link providers#provider-recipe Provider Recipe}.
|
|
||||||
*/
|
|
||||||
config: config,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name angular.Module#run
|
|
||||||
* @module ng
|
|
||||||
* @param {Function} initializationFn Execute this function after injector creation.
|
|
||||||
* Useful for application initialization.
|
|
||||||
* @description
|
|
||||||
* Use this method to register work which should be performed when the injector is done
|
|
||||||
* loading all modules.
|
|
||||||
*/
|
|
||||||
run: function(block) {
|
|
||||||
runBlocks.push(block);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (configFn) {
|
|
||||||
config(configFn);
|
|
||||||
}
|
|
||||||
|
|
||||||
return moduleInstance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} provider
|
|
||||||
* @param {string} method
|
|
||||||
* @param {String=} insertMethod
|
|
||||||
* @returns {angular.Module}
|
|
||||||
*/
|
|
||||||
function invokeLater(provider, method, insertMethod, queue) {
|
|
||||||
if (!queue) queue = invokeQueue;
|
|
||||||
return function() {
|
|
||||||
queue[insertMethod || 'push']([provider, method, arguments]);
|
|
||||||
return moduleInstance;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} provider
|
|
||||||
* @param {string} method
|
|
||||||
* @returns {angular.Module}
|
|
||||||
*/
|
|
||||||
function invokeLaterAndSetModuleName(provider, method, queue) {
|
|
||||||
if (!queue) queue = invokeQueue;
|
|
||||||
return function(recipeName, factoryFunction) {
|
|
||||||
if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
|
|
||||||
queue.push([provider, method, arguments]);
|
|
||||||
return moduleInstance;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
setupModuleLoader(window);
|
|
||||||
})(window);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closure compiler type information
|
|
||||||
*
|
|
||||||
* @typedef { {
|
|
||||||
* requires: !Array.<string>,
|
|
||||||
* invokeQueue: !Array.<Array.<*>>,
|
|
||||||
*
|
|
||||||
* service: function(string, Function):angular.Module,
|
|
||||||
* factory: function(string, Function):angular.Module,
|
|
||||||
* value: function(string, *):angular.Module,
|
|
||||||
*
|
|
||||||
* filter: function(string, Function):angular.Module,
|
|
||||||
*
|
|
||||||
* init: function(Function):angular.Module
|
|
||||||
* } }
|
|
||||||
*/
|
|
||||||
angular.Module;
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
/*
|
|
||||||
AngularJS v1.6.4
|
|
||||||
(c) 2010-2017 Google, Inc. http://angularjs.org
|
|
||||||
License: MIT
|
|
||||||
*/
|
|
||||||
(function(){'use strict';function g(a,f){f=f||Error;return function(){var d=arguments[0],e;e="["+(a?a+":":"")+d+"] http://errors.angularjs.org/1.6.4/"+(a?a+"/":"")+d;for(d=1;d<arguments.length;d++){e=e+(1==d?"?":"&")+"p"+(d-1)+"=";var q=encodeURIComponent,b;b=arguments[d];b="function"==typeof b?b.toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof b?"undefined":"string"!=typeof b?JSON.stringify(b):b;e+=q(b)}return new f(e)}}(function(a){function f(a,b,d){return a[b]||(a[b]=d())}var d=g("$injector"),
|
|
||||||
e=g("ng");a=f(a,"angular",Object);a.$$minErr=a.$$minErr||g;return f(a,"module",function(){var a={};return function(b,g,l){var m={};if("hasOwnProperty"===b)throw e("badname","module");g&&a.hasOwnProperty(b)&&(a[b]=null);return f(a,b,function(){function a(b,d,e,c){c||(c=f);return function(){c[e||"push"]([b,d,arguments]);return h}}function c(a,d,c){c||(c=f);return function(f,e){e&&"function"===typeof e&&(e.$$moduleName=b);c.push([a,d,arguments]);return h}}if(!g)throw d("nomod",b);var f=[],k=[],n=[],
|
|
||||||
p=a("$injector","invoke","push",k),h={_invokeQueue:f,_configBlocks:k,_runBlocks:n,info:function(a){if("undefined"!==typeof a){if(null===a||"object"!==typeof a)throw e("aobj","value");m=a;return this}return m},requires:g,name:b,provider:c("$provide","provider"),factory:c("$provide","factory"),service:c("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),decorator:c("$provide","decorator",k),animation:c("$animateProvider","register"),filter:c("$filterProvider",
|
|
||||||
"register"),controller:c("$controllerProvider","register"),directive:c("$compileProvider","directive"),component:c("$compileProvider","component"),config:p,run:function(a){n.push(a);return this}};l&&p(l);return h})}})})(window)})(window);
|
|
||||||
//# sourceMappingURL=angular-loader.min.js.map
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"version":3,
|
|
||||||
"file":"angular-loader.min.js",
|
|
||||||
"lineCount":9,
|
|
||||||
"mappings":"A;;;;;aAMC,SAAQ,EAAG,CAqEZA,QAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,KAAAA,OAAAA,SAAAA,EAAAA,CAAAA,IAAAA,EAAAA,SAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,CAAAA,CAAAA,sCAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,CAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,SAAAA,OAAAA,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAAA,CAAAA,CAAAA,GAAAA,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,EAAAA,GAAAA,KAAAA,EAAAA,kBAAAA,CAAAA,CAAAA,EAAAA,CAAAA,SAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,UAAAA,EAAAA,MAAAA,EAAAA,CAAAA,CAAAA,SAAAA,EAAAA,QAAAA,CAAAA,aAAAA,CAAAA,EAAAA,CAAAA,CAAAA,WAAAA,EAAAA,MAAAA,EAAAA,CAAAA,WAAAA,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,CAAAA,IAAAA,UAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAyCAC,SAA0B,CAACC,CAAD,CAAS,CAKjCC,QAASA,EAAM,CAACC,CAAD,CAAMC,CAAN,CAAYC,CAAZ,CAAqB,CAClC,MAAOF,EAAA,CAAIC,CAAJ,CAAP,GAAqBD,CAAA,CAAIC,CAAJ,CAArB,CAAiCC,CAAA,EAAjC,CADkC,CAHpC,IAAIC,EAAkBP,CAAA,CAAO,WAAP,CAAtB;AACIQ,EAAWR,CAAA,CAAO,IAAP,CAMXS,EAAAA,CAAUN,CAAA,CAAOD,CAAP,CAAe,SAAf,CAA0BQ,MAA1B,CAGdD,EAAAE,SAAA,CAAmBF,CAAAE,SAAnB,EAAuCX,CAEvC,OAAOG,EAAA,CAAOM,CAAP,CAAgB,QAAhB,CAA0B,QAAQ,EAAG,CAE1C,IAAIG,EAAU,EAqDd,OAAOC,SAAe,CAACR,CAAD,CAAOS,CAAP,CAAiBC,CAAjB,CAA2B,CAE/C,IAAIC,EAAO,EAGT,IAAa,gBAAb,GAKsBX,CALtB,CACE,KAAMG,EAAA,CAAS,SAAT,CAIoBS,QAJpB,CAAN,CAKAH,CAAJ,EAAgBF,CAAAM,eAAA,CAAuBb,CAAvB,CAAhB,GACEO,CAAA,CAAQP,CAAR,CADF,CACkB,IADlB,CAGA,OAAOF,EAAA,CAAOS,CAAP,CAAgBP,CAAhB,CAAsB,QAAQ,EAAG,CA8RtCc,QAASA,EAAW,CAACC,CAAD,CAAWC,CAAX,CAAmBC,CAAnB,CAAiCC,CAAjC,CAAwC,CACrDA,CAAL,GAAYA,CAAZ,CAAoBC,CAApB,CACA,OAAO,SAAQ,EAAG,CAChBD,CAAA,CAAMD,CAAN,EAAsB,MAAtB,CAAA,CAA8B,CAACF,CAAD,CAAWC,CAAX,CAAmBI,SAAnB,CAA9B,CACA,OAAOC,EAFS,CAFwC,CAa5DC,QAASA,EAA2B,CAACP,CAAD,CAAWC,CAAX,CAAmBE,CAAnB,CAA0B,CACvDA,CAAL,GAAYA,CAAZ,CAAoBC,CAApB,CACA,OAAO,SAAQ,CAACI,CAAD,CAAaC,CAAb,CAA8B,CACvCA,CAAJ,EA9e4C,UA8e5C,GA9e2B,MA8eOA,EAAlC,GAAoDA,CAAAC,aAApD,CAAmFzB,CAAnF,CACAkB,EAAAQ,KAAA,CAAW,CAACX,CAAD,CAAWC,CAAX,CAAmBI,SAAnB,CAAX,CACA,OAAOC,EAHoC,CAFe,CA1S9D,GAAKZ,CAAAA,CAAL,CACE,KAAMP,EAAA,CAAgB,OAAhB,CAEiDF,CAFjD,CAAN,CAMF,IAAImB,EAAc,EAAlB,CAGIQ,EAAe,EAHnB,CAMIC,EAAY,EANhB;AAQIC,EAASf,CAAA,CAAY,WAAZ,CAAyB,QAAzB,CAAmC,MAAnC,CAA2Ca,CAA3C,CARb,CAWIN,EAAiB,CAEnBS,aAAcX,CAFK,CAGnBY,cAAeJ,CAHI,CAInBK,WAAYJ,CAJO,CAoCnBjB,KAAMA,QAAQ,CAACsB,CAAD,CAAQ,CACpB,GAvP2C,WAuP3C,GAvP0B,MAuPZA,EAAd,CAAsB,CACpB,GAvPiC,IAuPjC,GAAcA,CAAd,EAvP0D,QAuP1D,GAvPyC,MAuP3BA,EAAd,CAAsB,KAAM9B,EAAA,CAAS,MAAT,CAAuD,OAAvD,CAAN,CACtBQ,CAAA,CAAOsB,CACP,OAAO,KAHa,CAKtB,MAAOtB,EANa,CApCH,CAsDnBF,SAAUA,CAtDS,CAgEnBT,KAAMA,CAhEa,CA6EnBe,SAAUO,CAAA,CAA4B,UAA5B,CAAwC,UAAxC,CA7ES,CAwFnBrB,QAASqB,CAAA,CAA4B,UAA5B,CAAwC,SAAxC,CAxFU,CAmGnBY,QAASZ,CAAA,CAA4B,UAA5B,CAAwC,SAAxC,CAnGU,CA8GnBW,MAAOnB,CAAA,CAAY,UAAZ,CAAwB,OAAxB,CA9GY,CA0HnBqB,SAAUrB,CAAA,CAAY,UAAZ,CAAwB,UAAxB,CAAoC,SAApC,CA1HS,CAsInBsB,UAAWd,CAAA,CAA4B,UAA5B,CAAwC,WAAxC,CAAqDK,CAArD,CAtIQ,CAwKnBU,UAAWf,CAAA,CAA4B,kBAA5B,CAAgD,UAAhD,CAxKQ,CA0LnBgB,OAAQhB,CAAA,CAA4B,iBAA5B;AAA+C,UAA/C,CA1LW,CAsMnBiB,WAAYjB,CAAA,CAA4B,qBAA5B,CAAmD,UAAnD,CAtMO,CAmNnBkB,UAAWlB,CAAA,CAA4B,kBAA5B,CAAgD,WAAhD,CAnNQ,CAgOnBmB,UAAWnB,CAAA,CAA4B,kBAA5B,CAAgD,WAAhD,CAhOQ,CA6OnBO,OAAQA,CA7OW,CAyPnBa,IAAKA,QAAQ,CAACC,CAAD,CAAQ,CACnBf,CAAAF,KAAA,CAAeiB,CAAf,CACA,OAAO,KAFY,CAzPF,CA+PjBjC,EAAJ,EACEmB,CAAA,CAAOnB,CAAP,CAGF,OAAOW,EAtR+B,CAAjC,CAdwC,CAvDP,CAArC,CAd0B,CAAnCzB,CA4YA,CAAkBC,MAAlB,CA1fY,CAAX,CAAD,CA2fGA,MA3fH;",
|
|
||||||
"sources":["angular-loader.js"],
|
|
||||||
"names":["minErr","setupModuleLoader","window","ensure","obj","name","factory","$injectorMinErr","ngMinErr","angular","Object","$$minErr","modules","module","requires","configFn","info","context","hasOwnProperty","invokeLater","provider","method","insertMethod","queue","invokeQueue","arguments","moduleInstance","invokeLaterAndSetModuleName","recipeName","factoryFunction","$$moduleName","push","configBlocks","runBlocks","config","_invokeQueue","_configBlocks","_runBlocks","value","service","constant","decorator","animation","filter","controller","directive","component","run","block"]
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-loader",
|
|
||||||
"version": "1.6.4",
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "./angular-loader.js",
|
|
||||||
"ignore": [],
|
|
||||||
"dependencies": {
|
|
||||||
"angular": "1.6.4"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-loader",
|
|
||||||
"version": "1.6.4",
|
|
||||||
"description": "AngularJS module for asynchronously loading modules",
|
|
||||||
"main": "angular-loader.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/angular/angular.js.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"angular",
|
|
||||||
"framework",
|
|
||||||
"browser",
|
|
||||||
"loader",
|
|
||||||
"client-side"
|
|
||||||
],
|
|
||||||
"author": "Angular Core Team <angular-core+npm@google.com>",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/angular/angular.js/issues"
|
|
||||||
},
|
|
||||||
"homepage": "http://angularjs.org",
|
|
||||||
"jspm": {
|
|
||||||
"shim": {
|
|
||||||
"angular-loader": {
|
|
||||||
"deps": ["angular"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2016 Angular
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -1,68 +0,0 @@
|
||||||
# packaged angular-resource
|
|
||||||
|
|
||||||
This repo is for distribution on `npm` and `bower`. The source for this module is in the
|
|
||||||
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngResource).
|
|
||||||
Please file issues and pull requests against that repo.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
You can install this package either with `npm` or with `bower`.
|
|
||||||
|
|
||||||
### npm
|
|
||||||
|
|
||||||
```shell
|
|
||||||
npm install angular-resource
|
|
||||||
```
|
|
||||||
|
|
||||||
Then add `ngResource` as a dependency for your app:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
angular.module('myApp', [require('angular-resource')]);
|
|
||||||
```
|
|
||||||
|
|
||||||
### bower
|
|
||||||
|
|
||||||
```shell
|
|
||||||
bower install angular-resource
|
|
||||||
```
|
|
||||||
|
|
||||||
Add a `<script>` to your `index.html`:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<script src="/bower_components/angular-resource/angular-resource.js"></script>
|
|
||||||
```
|
|
||||||
|
|
||||||
Then add `ngResource` as a dependency for your app:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
angular.module('myApp', ['ngResource']);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
Documentation is available on the
|
|
||||||
[AngularJS docs site](http://docs.angularjs.org/api/ngResource).
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
The MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
|
@ -1,858 +0,0 @@
|
||||||
/**
|
|
||||||
* @license AngularJS v1.6.4
|
|
||||||
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
|
||||||
* License: MIT
|
|
||||||
*/
|
|
||||||
(function(window, angular) {'use strict';
|
|
||||||
|
|
||||||
var $resourceMinErr = angular.$$minErr('$resource');
|
|
||||||
|
|
||||||
// Helper functions and regex to lookup a dotted path on an object
|
|
||||||
// stopping at undefined/null. The path must be composed of ASCII
|
|
||||||
// identifiers (just like $parse)
|
|
||||||
var MEMBER_NAME_REGEX = /^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;
|
|
||||||
|
|
||||||
function isValidDottedPath(path) {
|
|
||||||
return (path != null && path !== '' && path !== 'hasOwnProperty' &&
|
|
||||||
MEMBER_NAME_REGEX.test('.' + path));
|
|
||||||
}
|
|
||||||
|
|
||||||
function lookupDottedPath(obj, path) {
|
|
||||||
if (!isValidDottedPath(path)) {
|
|
||||||
throw $resourceMinErr('badmember', 'Dotted member path "@{0}" is invalid.', path);
|
|
||||||
}
|
|
||||||
var keys = path.split('.');
|
|
||||||
for (var i = 0, ii = keys.length; i < ii && angular.isDefined(obj); i++) {
|
|
||||||
var key = keys[i];
|
|
||||||
obj = (obj !== null) ? obj[key] : undefined;
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a shallow copy of an object and clear other fields from the destination
|
|
||||||
*/
|
|
||||||
function shallowClearAndCopy(src, dst) {
|
|
||||||
dst = dst || {};
|
|
||||||
|
|
||||||
angular.forEach(dst, function(value, key) {
|
|
||||||
delete dst[key];
|
|
||||||
});
|
|
||||||
|
|
||||||
for (var key in src) {
|
|
||||||
if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
|
|
||||||
dst[key] = src[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc module
|
|
||||||
* @name ngResource
|
|
||||||
* @description
|
|
||||||
*
|
|
||||||
* # ngResource
|
|
||||||
*
|
|
||||||
* The `ngResource` module provides interaction support with RESTful services
|
|
||||||
* via the $resource service.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* <div doc-module-components="ngResource"></div>
|
|
||||||
*
|
|
||||||
* See {@link ngResource.$resourceProvider} and {@link ngResource.$resource} for usage.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc provider
|
|
||||||
* @name $resourceProvider
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
*
|
|
||||||
* Use `$resourceProvider` to change the default behavior of the {@link ngResource.$resource}
|
|
||||||
* service.
|
|
||||||
*
|
|
||||||
* ## Dependencies
|
|
||||||
* Requires the {@link ngResource } module to be installed.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc service
|
|
||||||
* @name $resource
|
|
||||||
* @requires $http
|
|
||||||
* @requires ng.$log
|
|
||||||
* @requires $q
|
|
||||||
* @requires ng.$timeout
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* A factory which creates a resource object that lets you interact with
|
|
||||||
* [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.
|
|
||||||
*
|
|
||||||
* The returned resource object has action methods which provide high-level behaviors without
|
|
||||||
* the need to interact with the low level {@link ng.$http $http} service.
|
|
||||||
*
|
|
||||||
* Requires the {@link ngResource `ngResource`} module to be installed.
|
|
||||||
*
|
|
||||||
* By default, trailing slashes will be stripped from the calculated URLs,
|
|
||||||
* which can pose problems with server backends that do not expect that
|
|
||||||
* behavior. This can be disabled by configuring the `$resourceProvider` like
|
|
||||||
* this:
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
app.config(['$resourceProvider', function($resourceProvider) {
|
|
||||||
// Don't strip trailing slashes from calculated URLs
|
|
||||||
$resourceProvider.defaults.stripTrailingSlashes = false;
|
|
||||||
}]);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param {string} url A parameterized URL template with parameters prefixed by `:` as in
|
|
||||||
* `/user/:username`. If you are using a URL with a port number (e.g.
|
|
||||||
* `http://example.com:8080/api`), it will be respected.
|
|
||||||
*
|
|
||||||
* If you are using a url with a suffix, just add the suffix, like this:
|
|
||||||
* `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')`
|
|
||||||
* or even `$resource('http://example.com/resource/:resource_id.:format')`
|
|
||||||
* If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be
|
|
||||||
* collapsed down to a single `.`. If you need this sequence to appear and not collapse then you
|
|
||||||
* can escape it with `/\.`.
|
|
||||||
*
|
|
||||||
* @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
|
|
||||||
* `actions` methods. If a parameter value is a function, it will be called every time
|
|
||||||
* a param value needs to be obtained for a request (unless the param was overridden). The function
|
|
||||||
* will be passed the current data value as an argument.
|
|
||||||
*
|
|
||||||
* Each key value in the parameter object is first bound to url template if present and then any
|
|
||||||
* excess keys are appended to the url search query after the `?`.
|
|
||||||
*
|
|
||||||
* Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in
|
|
||||||
* URL `/path/greet?salutation=Hello`.
|
|
||||||
*
|
|
||||||
* If the parameter value is prefixed with `@`, then the value for that parameter will be
|
|
||||||
* extracted from the corresponding property on the `data` object (provided when calling actions
|
|
||||||
* with a request body).
|
|
||||||
* For example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of
|
|
||||||
* `someParam` will be `data.someProp`.
|
|
||||||
* Note that the parameter will be ignored, when calling a "GET" action method (i.e. an action
|
|
||||||
* method that does not accept a request body)
|
|
||||||
*
|
|
||||||
* @param {Object.<Object>=} actions Hash with declaration of custom actions that will be available
|
|
||||||
* in addition to the default set of resource actions (see below). If a custom action has the same
|
|
||||||
* key as a default action (e.g. `save`), then the default action will be *overwritten*, and not
|
|
||||||
* extended.
|
|
||||||
*
|
|
||||||
* The declaration should be created in the format of {@link ng.$http#usage $http.config}:
|
|
||||||
*
|
|
||||||
* {action1: {method:?, params:?, isArray:?, headers:?, ...},
|
|
||||||
* action2: {method:?, params:?, isArray:?, headers:?, ...},
|
|
||||||
* ...}
|
|
||||||
*
|
|
||||||
* Where:
|
|
||||||
*
|
|
||||||
* - **`action`** – {string} – The name of action. This name becomes the name of the method on
|
|
||||||
* your resource object.
|
|
||||||
* - **`method`** – {string} – Case insensitive HTTP method (e.g. `GET`, `POST`, `PUT`,
|
|
||||||
* `DELETE`, `JSONP`, etc).
|
|
||||||
* - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of
|
|
||||||
* the parameter value is a function, it will be called every time when a param value needs to
|
|
||||||
* be obtained for a request (unless the param was overridden). The function will be passed the
|
|
||||||
* current data value as an argument.
|
|
||||||
* - **`url`** – {string} – action specific `url` override. The url templating is supported just
|
|
||||||
* like for the resource-level urls.
|
|
||||||
* - **`isArray`** – {boolean=} – If true then the returned object for this action is an array,
|
|
||||||
* see `returns` section.
|
|
||||||
* - **`transformRequest`** –
|
|
||||||
* `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
|
|
||||||
* transform function or an array of such functions. The transform function takes the http
|
|
||||||
* request body and headers and returns its transformed (typically serialized) version.
|
|
||||||
* By default, transformRequest will contain one function that checks if the request data is
|
|
||||||
* an object and serializes it using `angular.toJson`. To prevent this behavior, set
|
|
||||||
* `transformRequest` to an empty array: `transformRequest: []`
|
|
||||||
* - **`transformResponse`** –
|
|
||||||
* `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` –
|
|
||||||
* transform function or an array of such functions. The transform function takes the http
|
|
||||||
* response body, headers and status and returns its transformed (typically deserialized)
|
|
||||||
* version.
|
|
||||||
* By default, transformResponse will contain one function that checks if the response looks
|
|
||||||
* like a JSON string and deserializes it using `angular.fromJson`. To prevent this behavior,
|
|
||||||
* set `transformResponse` to an empty array: `transformResponse: []`
|
|
||||||
* - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
|
|
||||||
* GET request, otherwise if a cache instance built with
|
|
||||||
* {@link ng.$cacheFactory $cacheFactory} is supplied, this cache will be used for
|
|
||||||
* caching.
|
|
||||||
* - **`timeout`** – `{number}` – timeout in milliseconds.<br />
|
|
||||||
* **Note:** In contrast to {@link ng.$http#usage $http.config}, {@link ng.$q promises} are
|
|
||||||
* **not** supported in $resource, because the same value would be used for multiple requests.
|
|
||||||
* If you are looking for a way to cancel requests, you should use the `cancellable` option.
|
|
||||||
* - **`cancellable`** – `{boolean}` – if set to true, the request made by a "non-instance" call
|
|
||||||
* will be cancelled (if not already completed) by calling `$cancelRequest()` on the call's
|
|
||||||
* return value. Calling `$cancelRequest()` for a non-cancellable or an already
|
|
||||||
* completed/cancelled request will have no effect.<br />
|
|
||||||
* - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the
|
|
||||||
* XHR object. See
|
|
||||||
* [requests with credentials](https://developer.mozilla.org/en/http_access_control#section_5)
|
|
||||||
* for more information.
|
|
||||||
* - **`responseType`** - `{string}` - see
|
|
||||||
* [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).
|
|
||||||
* - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
|
|
||||||
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
|
|
||||||
* with `http response` object. See {@link ng.$http $http interceptors}.
|
|
||||||
* - **`hasBody`** - `{boolean}` - allows to specify if a request body should be included or not.
|
|
||||||
* If not specified only POST, PUT and PATCH requests will have a body.
|
|
||||||
*
|
|
||||||
* @param {Object} options Hash with custom settings that should extend the
|
|
||||||
* default `$resourceProvider` behavior. The supported options are:
|
|
||||||
*
|
|
||||||
* - **`stripTrailingSlashes`** – {boolean} – If true then the trailing
|
|
||||||
* slashes from any calculated URL will be stripped. (Defaults to true.)
|
|
||||||
* - **`cancellable`** – {boolean} – If true, the request made by a "non-instance" call will be
|
|
||||||
* cancelled (if not already completed) by calling `$cancelRequest()` on the call's return value.
|
|
||||||
* This can be overwritten per action. (Defaults to false.)
|
|
||||||
*
|
|
||||||
* @returns {Object} A resource "class" object with methods for the default set of resource actions
|
|
||||||
* optionally extended with custom `actions`. The default set contains these actions:
|
|
||||||
* ```js
|
|
||||||
* { 'get': {method:'GET'},
|
|
||||||
* 'save': {method:'POST'},
|
|
||||||
* 'query': {method:'GET', isArray:true},
|
|
||||||
* 'remove': {method:'DELETE'},
|
|
||||||
* 'delete': {method:'DELETE'} };
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Calling these methods invoke an {@link ng.$http} with the specified http method,
|
|
||||||
* destination and parameters. When the data is returned from the server then the object is an
|
|
||||||
* instance of the resource class. The actions `save`, `remove` and `delete` are available on it
|
|
||||||
* as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
|
|
||||||
* read, update, delete) on server-side data like this:
|
|
||||||
* ```js
|
|
||||||
* var User = $resource('/user/:userId', {userId:'@id'});
|
|
||||||
* var user = User.get({userId:123}, function() {
|
|
||||||
* user.abc = true;
|
|
||||||
* user.$save();
|
|
||||||
* });
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* It is important to realize that invoking a $resource object method immediately returns an
|
|
||||||
* empty reference (object or array depending on `isArray`). Once the data is returned from the
|
|
||||||
* server the existing reference is populated with the actual data. This is a useful trick since
|
|
||||||
* usually the resource is assigned to a model which is then rendered by the view. Having an empty
|
|
||||||
* object results in no rendering, once the data arrives from the server then the object is
|
|
||||||
* populated with the data and the view automatically re-renders itself showing the new data. This
|
|
||||||
* means that in most cases one never has to write a callback function for the action methods.
|
|
||||||
*
|
|
||||||
* The action methods on the class object or instance object can be invoked with the following
|
|
||||||
* parameters:
|
|
||||||
*
|
|
||||||
* - "class" actions without a body: `Resource.action([parameters], [success], [error])`
|
|
||||||
* - "class" actions with a body: `Resource.action([parameters], postData, [success], [error])`
|
|
||||||
* - instance actions: `instance.$action([parameters], [success], [error])`
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* When calling instance methods, the instance itself is used as the request body (if the action
|
|
||||||
* should have a body). By default, only actions using `POST`, `PUT` or `PATCH` have request
|
|
||||||
* bodies, but you can use the `hasBody` configuration option to specify whether an action
|
|
||||||
* should have a body or not (regardless of its HTTP method).
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Success callback is called with (value (Object|Array), responseHeaders (Function),
|
|
||||||
* status (number), statusText (string)) arguments, where the value is the populated resource
|
|
||||||
* instance or collection object. The error callback is called with (httpResponse) argument.
|
|
||||||
*
|
|
||||||
* Class actions return empty instance (with additional properties below).
|
|
||||||
* Instance actions return promise of the action.
|
|
||||||
*
|
|
||||||
* The Resource instances and collections have these additional properties:
|
|
||||||
*
|
|
||||||
* - `$promise`: the {@link ng.$q promise} of the original server interaction that created this
|
|
||||||
* instance or collection.
|
|
||||||
*
|
|
||||||
* On success, the promise is resolved with the same resource instance or collection object,
|
|
||||||
* updated with data from server. This makes it easy to use in
|
|
||||||
* {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view
|
|
||||||
* rendering until the resource(s) are loaded.
|
|
||||||
*
|
|
||||||
* On failure, the promise is rejected with the {@link ng.$http http response} object, without
|
|
||||||
* the `resource` property.
|
|
||||||
*
|
|
||||||
* If an interceptor object was provided, the promise will instead be resolved with the value
|
|
||||||
* returned by the interceptor.
|
|
||||||
*
|
|
||||||
* - `$resolved`: `true` after first server interaction is completed (either with success or
|
|
||||||
* rejection), `false` before that. Knowing if the Resource has been resolved is useful in
|
|
||||||
* data-binding.
|
|
||||||
*
|
|
||||||
* The Resource instances and collections have these additional methods:
|
|
||||||
*
|
|
||||||
* - `$cancelRequest`: If there is a cancellable, pending request related to the instance or
|
|
||||||
* collection, calling this method will abort the request.
|
|
||||||
*
|
|
||||||
* The Resource instances have these additional methods:
|
|
||||||
*
|
|
||||||
* - `toJSON`: It returns a simple object without any of the extra properties added as part of
|
|
||||||
* the Resource API. This object can be serialized through {@link angular.toJson} safely
|
|
||||||
* without attaching Angular-specific fields. Notice that `JSON.stringify` (and
|
|
||||||
* `angular.toJson`) automatically use this method when serializing a Resource instance
|
|
||||||
* (see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON%28%29_behavior)).
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* # Credit card resource
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
// Define CreditCard class
|
|
||||||
var CreditCard = $resource('/user/:userId/card/:cardId',
|
|
||||||
{userId:123, cardId:'@id'}, {
|
|
||||||
charge: {method:'POST', params:{charge:true}}
|
|
||||||
});
|
|
||||||
|
|
||||||
// We can retrieve a collection from the server
|
|
||||||
var cards = CreditCard.query(function() {
|
|
||||||
// GET: /user/123/card
|
|
||||||
// server returns: [ {id:456, number:'1234', name:'Smith'} ];
|
|
||||||
|
|
||||||
var card = cards[0];
|
|
||||||
// each item is an instance of CreditCard
|
|
||||||
expect(card instanceof CreditCard).toEqual(true);
|
|
||||||
card.name = "J. Smith";
|
|
||||||
// non GET methods are mapped onto the instances
|
|
||||||
card.$save();
|
|
||||||
// POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'}
|
|
||||||
// server returns: {id:456, number:'1234', name: 'J. Smith'};
|
|
||||||
|
|
||||||
// our custom method is mapped as well.
|
|
||||||
card.$charge({amount:9.99});
|
|
||||||
// POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'}
|
|
||||||
});
|
|
||||||
|
|
||||||
// we can create an instance as well
|
|
||||||
var newCard = new CreditCard({number:'0123'});
|
|
||||||
newCard.name = "Mike Smith";
|
|
||||||
newCard.$save();
|
|
||||||
// POST: /user/123/card {number:'0123', name:'Mike Smith'}
|
|
||||||
// server returns: {id:789, number:'0123', name: 'Mike Smith'};
|
|
||||||
expect(newCard.id).toEqual(789);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* The object returned from this function execution is a resource "class" which has "static" method
|
|
||||||
* for each action in the definition.
|
|
||||||
*
|
|
||||||
* Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and
|
|
||||||
* `headers`.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* # User resource
|
|
||||||
*
|
|
||||||
* When the data is returned from the server then the object is an instance of the resource type and
|
|
||||||
* all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
|
|
||||||
* operations (create, read, update, delete) on server-side data.
|
|
||||||
|
|
||||||
```js
|
|
||||||
var User = $resource('/user/:userId', {userId:'@id'});
|
|
||||||
User.get({userId:123}, function(user) {
|
|
||||||
user.abc = true;
|
|
||||||
user.$save();
|
|
||||||
});
|
|
||||||
```
|
|
||||||
*
|
|
||||||
* It's worth noting that the success callback for `get`, `query` and other methods gets passed
|
|
||||||
* in the response that came from the server as well as $http header getter function, so one
|
|
||||||
* could rewrite the above example and get access to http headers as:
|
|
||||||
*
|
|
||||||
```js
|
|
||||||
var User = $resource('/user/:userId', {userId:'@id'});
|
|
||||||
User.get({userId:123}, function(user, getResponseHeaders){
|
|
||||||
user.abc = true;
|
|
||||||
user.$save(function(user, putResponseHeaders) {
|
|
||||||
//user => saved user object
|
|
||||||
//putResponseHeaders => $http header getter
|
|
||||||
});
|
|
||||||
});
|
|
||||||
```
|
|
||||||
*
|
|
||||||
* You can also access the raw `$http` promise via the `$promise` property on the object returned
|
|
||||||
*
|
|
||||||
```
|
|
||||||
var User = $resource('/user/:userId', {userId:'@id'});
|
|
||||||
User.get({userId:123})
|
|
||||||
.$promise.then(function(user) {
|
|
||||||
$scope.user = user;
|
|
||||||
});
|
|
||||||
```
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* # Creating a custom 'PUT' request
|
|
||||||
*
|
|
||||||
* In this example we create a custom method on our resource to make a PUT request
|
|
||||||
* ```js
|
|
||||||
* var app = angular.module('app', ['ngResource', 'ngRoute']);
|
|
||||||
*
|
|
||||||
* // Some APIs expect a PUT request in the format URL/object/ID
|
|
||||||
* // Here we are creating an 'update' method
|
|
||||||
* app.factory('Notes', ['$resource', function($resource) {
|
|
||||||
* return $resource('/notes/:id', null,
|
|
||||||
* {
|
|
||||||
* 'update': { method:'PUT' }
|
|
||||||
* });
|
|
||||||
* }]);
|
|
||||||
*
|
|
||||||
* // In our controller we get the ID from the URL using ngRoute and $routeParams
|
|
||||||
* // We pass in $routeParams and our Notes factory along with $scope
|
|
||||||
* app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes',
|
|
||||||
function($scope, $routeParams, Notes) {
|
|
||||||
* // First get a note object from the factory
|
|
||||||
* var note = Notes.get({ id:$routeParams.id });
|
|
||||||
* $id = note.id;
|
|
||||||
*
|
|
||||||
* // Now call update passing in the ID first then the object you are updating
|
|
||||||
* Notes.update({ id:$id }, note);
|
|
||||||
*
|
|
||||||
* // This will PUT /notes/ID with the note object in the request payload
|
|
||||||
* }]);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* # Cancelling requests
|
|
||||||
*
|
|
||||||
* If an action's configuration specifies that it is cancellable, you can cancel the request related
|
|
||||||
* to an instance or collection (as long as it is a result of a "non-instance" call):
|
|
||||||
*
|
|
||||||
```js
|
|
||||||
// ...defining the `Hotel` resource...
|
|
||||||
var Hotel = $resource('/api/hotel/:id', {id: '@id'}, {
|
|
||||||
// Let's make the `query()` method cancellable
|
|
||||||
query: {method: 'get', isArray: true, cancellable: true}
|
|
||||||
});
|
|
||||||
|
|
||||||
// ...somewhere in the PlanVacationController...
|
|
||||||
...
|
|
||||||
this.onDestinationChanged = function onDestinationChanged(destination) {
|
|
||||||
// We don't care about any pending request for hotels
|
|
||||||
// in a different destination any more
|
|
||||||
this.availableHotels.$cancelRequest();
|
|
||||||
|
|
||||||
// Let's query for hotels in '<destination>'
|
|
||||||
// (calls: /api/hotel?location=<destination>)
|
|
||||||
this.availableHotels = Hotel.query({location: destination});
|
|
||||||
};
|
|
||||||
```
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
angular.module('ngResource', ['ng']).
|
|
||||||
info({ angularVersion: '1.6.4' }).
|
|
||||||
provider('$resource', function ResourceProvider() {
|
|
||||||
var PROTOCOL_AND_IPV6_REGEX = /^https?:\/\/\[[^\]]*][^/]*/;
|
|
||||||
|
|
||||||
var provider = this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc property
|
|
||||||
* @name $resourceProvider#defaults
|
|
||||||
* @description
|
|
||||||
* Object containing default options used when creating `$resource` instances.
|
|
||||||
*
|
|
||||||
* The default values satisfy a wide range of usecases, but you may choose to overwrite any of
|
|
||||||
* them to further customize your instances. The available properties are:
|
|
||||||
*
|
|
||||||
* - **stripTrailingSlashes** – `{boolean}` – If true, then the trailing slashes from any
|
|
||||||
* calculated URL will be stripped.<br />
|
|
||||||
* (Defaults to true.)
|
|
||||||
* - **cancellable** – `{boolean}` – If true, the request made by a "non-instance" call will be
|
|
||||||
* cancelled (if not already completed) by calling `$cancelRequest()` on the call's return
|
|
||||||
* value. For more details, see {@link ngResource.$resource}. This can be overwritten per
|
|
||||||
* resource class or action.<br />
|
|
||||||
* (Defaults to false.)
|
|
||||||
* - **actions** - `{Object.<Object>}` - A hash with default actions declarations. Actions are
|
|
||||||
* high-level methods corresponding to RESTful actions/methods on resources. An action may
|
|
||||||
* specify what HTTP method to use, what URL to hit, if the return value will be a single
|
|
||||||
* object or a collection (array) of objects etc. For more details, see
|
|
||||||
* {@link ngResource.$resource}. The actions can also be enhanced or overwritten per resource
|
|
||||||
* class.<br />
|
|
||||||
* The default actions are:
|
|
||||||
* ```js
|
|
||||||
* {
|
|
||||||
* get: {method: 'GET'},
|
|
||||||
* save: {method: 'POST'},
|
|
||||||
* query: {method: 'GET', isArray: true},
|
|
||||||
* remove: {method: 'DELETE'},
|
|
||||||
* delete: {method: 'DELETE'}
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* #### Example
|
|
||||||
*
|
|
||||||
* For example, you can specify a new `update` action that uses the `PUT` HTTP verb:
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* angular.
|
|
||||||
* module('myApp').
|
|
||||||
* config(['$resourceProvider', function ($resourceProvider) {
|
|
||||||
* $resourceProvider.defaults.actions.update = {
|
|
||||||
* method: 'PUT'
|
|
||||||
* };
|
|
||||||
* });
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Or you can even overwrite the whole `actions` list and specify your own:
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* angular.
|
|
||||||
* module('myApp').
|
|
||||||
* config(['$resourceProvider', function ($resourceProvider) {
|
|
||||||
* $resourceProvider.defaults.actions = {
|
|
||||||
* create: {method: 'POST'},
|
|
||||||
* get: {method: 'GET'},
|
|
||||||
* getAll: {method: 'GET', isArray:true},
|
|
||||||
* update: {method: 'PUT'},
|
|
||||||
* delete: {method: 'DELETE'}
|
|
||||||
* };
|
|
||||||
* });
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
this.defaults = {
|
|
||||||
// Strip slashes by default
|
|
||||||
stripTrailingSlashes: true,
|
|
||||||
|
|
||||||
// Make non-instance requests cancellable (via `$cancelRequest()`)
|
|
||||||
cancellable: false,
|
|
||||||
|
|
||||||
// Default actions configuration
|
|
||||||
actions: {
|
|
||||||
'get': {method: 'GET'},
|
|
||||||
'save': {method: 'POST'},
|
|
||||||
'query': {method: 'GET', isArray: true},
|
|
||||||
'remove': {method: 'DELETE'},
|
|
||||||
'delete': {method: 'DELETE'}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.$get = ['$http', '$log', '$q', '$timeout', function($http, $log, $q, $timeout) {
|
|
||||||
|
|
||||||
var noop = angular.noop,
|
|
||||||
forEach = angular.forEach,
|
|
||||||
extend = angular.extend,
|
|
||||||
copy = angular.copy,
|
|
||||||
isArray = angular.isArray,
|
|
||||||
isDefined = angular.isDefined,
|
|
||||||
isFunction = angular.isFunction,
|
|
||||||
isNumber = angular.isNumber,
|
|
||||||
encodeUriQuery = angular.$$encodeUriQuery,
|
|
||||||
encodeUriSegment = angular.$$encodeUriSegment;
|
|
||||||
|
|
||||||
function Route(template, defaults) {
|
|
||||||
this.template = template;
|
|
||||||
this.defaults = extend({}, provider.defaults, defaults);
|
|
||||||
this.urlParams = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
Route.prototype = {
|
|
||||||
setUrlParams: function(config, params, actionUrl) {
|
|
||||||
var self = this,
|
|
||||||
url = actionUrl || self.template,
|
|
||||||
val,
|
|
||||||
encodedVal,
|
|
||||||
protocolAndIpv6 = '';
|
|
||||||
|
|
||||||
var urlParams = self.urlParams = Object.create(null);
|
|
||||||
forEach(url.split(/\W/), function(param) {
|
|
||||||
if (param === 'hasOwnProperty') {
|
|
||||||
throw $resourceMinErr('badname', 'hasOwnProperty is not a valid parameter name.');
|
|
||||||
}
|
|
||||||
if (!(new RegExp('^\\d+$').test(param)) && param &&
|
|
||||||
(new RegExp('(^|[^\\\\]):' + param + '(\\W|$)').test(url))) {
|
|
||||||
urlParams[param] = {
|
|
||||||
isQueryParamValue: (new RegExp('\\?.*=:' + param + '(?:\\W|$)')).test(url)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
url = url.replace(/\\:/g, ':');
|
|
||||||
url = url.replace(PROTOCOL_AND_IPV6_REGEX, function(match) {
|
|
||||||
protocolAndIpv6 = match;
|
|
||||||
return '';
|
|
||||||
});
|
|
||||||
|
|
||||||
params = params || {};
|
|
||||||
forEach(self.urlParams, function(paramInfo, urlParam) {
|
|
||||||
val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
|
|
||||||
if (isDefined(val) && val !== null) {
|
|
||||||
if (paramInfo.isQueryParamValue) {
|
|
||||||
encodedVal = encodeUriQuery(val, true);
|
|
||||||
} else {
|
|
||||||
encodedVal = encodeUriSegment(val);
|
|
||||||
}
|
|
||||||
url = url.replace(new RegExp(':' + urlParam + '(\\W|$)', 'g'), function(match, p1) {
|
|
||||||
return encodedVal + p1;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
url = url.replace(new RegExp('(/?):' + urlParam + '(\\W|$)', 'g'), function(match,
|
|
||||||
leadingSlashes, tail) {
|
|
||||||
if (tail.charAt(0) === '/') {
|
|
||||||
return tail;
|
|
||||||
} else {
|
|
||||||
return leadingSlashes + tail;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// strip trailing slashes and set the url (unless this behavior is specifically disabled)
|
|
||||||
if (self.defaults.stripTrailingSlashes) {
|
|
||||||
url = url.replace(/\/+$/, '') || '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collapse `/.` if found in the last URL path segment before the query.
|
|
||||||
// E.g. `http://url.com/id/.format?q=x` becomes `http://url.com/id.format?q=x`.
|
|
||||||
url = url.replace(/\/\.(?=\w+($|\?))/, '.');
|
|
||||||
// Replace escaped `/\.` with `/.`.
|
|
||||||
// (If `\.` comes from a param value, it will be encoded as `%5C.`.)
|
|
||||||
config.url = protocolAndIpv6 + url.replace(/\/(\\|%5C)\./, '/.');
|
|
||||||
|
|
||||||
|
|
||||||
// set params - delegate param encoding to $http
|
|
||||||
forEach(params, function(value, key) {
|
|
||||||
if (!self.urlParams[key]) {
|
|
||||||
config.params = config.params || {};
|
|
||||||
config.params[key] = value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function resourceFactory(url, paramDefaults, actions, options) {
|
|
||||||
var route = new Route(url, options);
|
|
||||||
|
|
||||||
actions = extend({}, provider.defaults.actions, actions);
|
|
||||||
|
|
||||||
function extractParams(data, actionParams) {
|
|
||||||
var ids = {};
|
|
||||||
actionParams = extend({}, paramDefaults, actionParams);
|
|
||||||
forEach(actionParams, function(value, key) {
|
|
||||||
if (isFunction(value)) { value = value(data); }
|
|
||||||
ids[key] = value && value.charAt && value.charAt(0) === '@' ?
|
|
||||||
lookupDottedPath(data, value.substr(1)) : value;
|
|
||||||
});
|
|
||||||
return ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
function defaultResponseInterceptor(response) {
|
|
||||||
return response.resource;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Resource(value) {
|
|
||||||
shallowClearAndCopy(value || {}, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Resource.prototype.toJSON = function() {
|
|
||||||
var data = extend({}, this);
|
|
||||||
delete data.$promise;
|
|
||||||
delete data.$resolved;
|
|
||||||
delete data.$cancelRequest;
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
forEach(actions, function(action, name) {
|
|
||||||
var hasBody = action.hasBody === true || (action.hasBody !== false && /^(POST|PUT|PATCH)$/i.test(action.method));
|
|
||||||
var numericTimeout = action.timeout;
|
|
||||||
var cancellable = isDefined(action.cancellable) ?
|
|
||||||
action.cancellable : route.defaults.cancellable;
|
|
||||||
|
|
||||||
if (numericTimeout && !isNumber(numericTimeout)) {
|
|
||||||
$log.debug('ngResource:\n' +
|
|
||||||
' Only numeric values are allowed as `timeout`.\n' +
|
|
||||||
' Promises are not supported in $resource, because the same value would ' +
|
|
||||||
'be used for multiple requests. If you are looking for a way to cancel ' +
|
|
||||||
'requests, you should use the `cancellable` option.');
|
|
||||||
delete action.timeout;
|
|
||||||
numericTimeout = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Resource[name] = function(a1, a2, a3, a4) {
|
|
||||||
var params = {}, data, success, error;
|
|
||||||
|
|
||||||
switch (arguments.length) {
|
|
||||||
case 4:
|
|
||||||
error = a4;
|
|
||||||
success = a3;
|
|
||||||
// falls through
|
|
||||||
case 3:
|
|
||||||
case 2:
|
|
||||||
if (isFunction(a2)) {
|
|
||||||
if (isFunction(a1)) {
|
|
||||||
success = a1;
|
|
||||||
error = a2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
success = a2;
|
|
||||||
error = a3;
|
|
||||||
// falls through
|
|
||||||
} else {
|
|
||||||
params = a1;
|
|
||||||
data = a2;
|
|
||||||
success = a3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// falls through
|
|
||||||
case 1:
|
|
||||||
if (isFunction(a1)) success = a1;
|
|
||||||
else if (hasBody) data = a1;
|
|
||||||
else params = a1;
|
|
||||||
break;
|
|
||||||
case 0: break;
|
|
||||||
default:
|
|
||||||
throw $resourceMinErr('badargs',
|
|
||||||
'Expected up to 4 arguments [params, data, success, error], got {0} arguments',
|
|
||||||
arguments.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
var isInstanceCall = this instanceof Resource;
|
|
||||||
var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
|
|
||||||
var httpConfig = {};
|
|
||||||
var responseInterceptor = action.interceptor && action.interceptor.response ||
|
|
||||||
defaultResponseInterceptor;
|
|
||||||
var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||
|
|
||||||
undefined;
|
|
||||||
var hasError = !!error;
|
|
||||||
var hasResponseErrorInterceptor = !!responseErrorInterceptor;
|
|
||||||
var timeoutDeferred;
|
|
||||||
var numericTimeoutPromise;
|
|
||||||
|
|
||||||
forEach(action, function(value, key) {
|
|
||||||
switch (key) {
|
|
||||||
default:
|
|
||||||
httpConfig[key] = copy(value);
|
|
||||||
break;
|
|
||||||
case 'params':
|
|
||||||
case 'isArray':
|
|
||||||
case 'interceptor':
|
|
||||||
case 'cancellable':
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!isInstanceCall && cancellable) {
|
|
||||||
timeoutDeferred = $q.defer();
|
|
||||||
httpConfig.timeout = timeoutDeferred.promise;
|
|
||||||
|
|
||||||
if (numericTimeout) {
|
|
||||||
numericTimeoutPromise = $timeout(timeoutDeferred.resolve, numericTimeout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasBody) httpConfig.data = data;
|
|
||||||
route.setUrlParams(httpConfig,
|
|
||||||
extend({}, extractParams(data, action.params || {}), params),
|
|
||||||
action.url);
|
|
||||||
|
|
||||||
var promise = $http(httpConfig).then(function(response) {
|
|
||||||
var data = response.data;
|
|
||||||
|
|
||||||
if (data) {
|
|
||||||
// Need to convert action.isArray to boolean in case it is undefined
|
|
||||||
if (isArray(data) !== (!!action.isArray)) {
|
|
||||||
throw $resourceMinErr('badcfg',
|
|
||||||
'Error in resource configuration for action `{0}`. Expected response to ' +
|
|
||||||
'contain an {1} but got an {2} (Request: {3} {4})', name, action.isArray ? 'array' : 'object',
|
|
||||||
isArray(data) ? 'array' : 'object', httpConfig.method, httpConfig.url);
|
|
||||||
}
|
|
||||||
if (action.isArray) {
|
|
||||||
value.length = 0;
|
|
||||||
forEach(data, function(item) {
|
|
||||||
if (typeof item === 'object') {
|
|
||||||
value.push(new Resource(item));
|
|
||||||
} else {
|
|
||||||
// Valid JSON values may be string literals, and these should not be converted
|
|
||||||
// into objects. These items will not have access to the Resource prototype
|
|
||||||
// methods, but unfortunately there
|
|
||||||
value.push(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
var promise = value.$promise; // Save the promise
|
|
||||||
shallowClearAndCopy(data, value);
|
|
||||||
value.$promise = promise; // Restore the promise
|
|
||||||
}
|
|
||||||
}
|
|
||||||
response.resource = value;
|
|
||||||
|
|
||||||
return response;
|
|
||||||
});
|
|
||||||
|
|
||||||
promise = promise['finally'](function() {
|
|
||||||
value.$resolved = true;
|
|
||||||
if (!isInstanceCall && cancellable) {
|
|
||||||
value.$cancelRequest = noop;
|
|
||||||
$timeout.cancel(numericTimeoutPromise);
|
|
||||||
timeoutDeferred = numericTimeoutPromise = httpConfig.timeout = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
promise = promise.then(
|
|
||||||
function(response) {
|
|
||||||
var value = responseInterceptor(response);
|
|
||||||
(success || noop)(value, response.headers, response.status, response.statusText);
|
|
||||||
return value;
|
|
||||||
},
|
|
||||||
(hasError || hasResponseErrorInterceptor) ?
|
|
||||||
function(response) {
|
|
||||||
if (hasError && !hasResponseErrorInterceptor) {
|
|
||||||
// Avoid `Possibly Unhandled Rejection` error,
|
|
||||||
// but still fulfill the returned promise with a rejection
|
|
||||||
promise.catch(noop);
|
|
||||||
}
|
|
||||||
if (hasError) error(response);
|
|
||||||
return hasResponseErrorInterceptor ?
|
|
||||||
responseErrorInterceptor(response) :
|
|
||||||
$q.reject(response);
|
|
||||||
} :
|
|
||||||
undefined);
|
|
||||||
|
|
||||||
if (!isInstanceCall) {
|
|
||||||
// we are creating instance / collection
|
|
||||||
// - set the initial promise
|
|
||||||
// - return the instance / collection
|
|
||||||
value.$promise = promise;
|
|
||||||
value.$resolved = false;
|
|
||||||
if (cancellable) value.$cancelRequest = cancelRequest;
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// instance call
|
|
||||||
return promise;
|
|
||||||
|
|
||||||
function cancelRequest(value) {
|
|
||||||
promise.catch(noop);
|
|
||||||
timeoutDeferred.resolve(value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Resource.prototype['$' + name] = function(params, success, error) {
|
|
||||||
if (isFunction(params)) {
|
|
||||||
error = success; success = params; params = {};
|
|
||||||
}
|
|
||||||
var result = Resource[name].call(this, params, this, success, error);
|
|
||||||
return result.$promise || result;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
Resource.bind = function(additionalParamDefaults) {
|
|
||||||
var extendedParamDefaults = extend({}, paramDefaults, additionalParamDefaults);
|
|
||||||
return resourceFactory(url, extendedParamDefaults, actions, options);
|
|
||||||
};
|
|
||||||
|
|
||||||
return Resource;
|
|
||||||
}
|
|
||||||
|
|
||||||
return resourceFactory;
|
|
||||||
}];
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
})(window, window.angular);
|
|
|
@ -1,15 +0,0 @@
|
||||||
/*
|
|
||||||
AngularJS v1.6.4
|
|
||||||
(c) 2010-2017 Google, Inc. http://angularjs.org
|
|
||||||
License: MIT
|
|
||||||
*/
|
|
||||||
(function(W,b){'use strict';function K(q,g){g=g||{};b.forEach(g,function(b,h){delete g[h]});for(var h in q)!q.hasOwnProperty(h)||"$"===h.charAt(0)&&"$"===h.charAt(1)||(g[h]=q[h]);return g}var B=b.$$minErr("$resource"),Q=/^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;b.module("ngResource",["ng"]).info({angularVersion:"1.6.4"}).provider("$resource",function(){var q=/^https?:\/\/\[[^\]]*][^/]*/,g=this;this.defaults={stripTrailingSlashes:!0,cancellable:!1,actions:{get:{method:"GET"},save:{method:"POST"},query:{method:"GET",
|
|
||||||
isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}}};this.$get=["$http","$log","$q","$timeout",function(h,P,L,M){function C(b,e){this.template=b;this.defaults=p({},g.defaults,e);this.urlParams={}}function x(D,e,u,m){function c(a,d){var c={};d=p({},e,d);t(d,function(d,l){y(d)&&(d=d(a));var f;if(d&&d.charAt&&"@"===d.charAt(0)){f=a;var k=d.substr(1);if(null==k||""===k||"hasOwnProperty"===k||!Q.test("."+k))throw B("badmember",k);for(var k=k.split("."),e=0,g=k.length;e<g&&b.isDefined(f);e++){var h=
|
|
||||||
k[e];f=null!==f?f[h]:void 0}}else f=d;c[l]=f});return c}function R(a){return a.resource}function l(a){K(a||{},this)}var q=new C(D,m);u=p({},g.defaults.actions,u);l.prototype.toJSON=function(){var a=p({},this);delete a.$promise;delete a.$resolved;delete a.$cancelRequest;return a};t(u,function(a,d){var b=!0===a.hasBody||!1!==a.hasBody&&/^(POST|PUT|PATCH)$/i.test(a.method),e=a.timeout,g=N(a.cancellable)?a.cancellable:q.defaults.cancellable;e&&!S(e)&&(P.debug("ngResource:\n Only numeric values are allowed as `timeout`.\n Promises are not supported in $resource, because the same value would be used for multiple requests. If you are looking for a way to cancel requests, you should use the `cancellable` option."),
|
|
||||||
delete a.timeout,e=null);l[d]=function(f,k,m,D){function u(a){r.catch(E);z.resolve(a)}var G={},v,w,A;switch(arguments.length){case 4:A=D,w=m;case 3:case 2:if(y(k)){if(y(f)){w=f;A=k;break}w=k;A=m}else{G=f;v=k;w=m;break}case 1:y(f)?w=f:b?v=f:G=f;break;case 0:break;default:throw B("badargs",arguments.length);}var F=this instanceof l,n=F?v:a.isArray?[]:new l(v),s={},C=a.interceptor&&a.interceptor.response||R,x=a.interceptor&&a.interceptor.responseError||void 0,H=!!A,I=!!x,z,J;t(a,function(a,d){switch(d){default:s[d]=
|
|
||||||
T(a);case "params":case "isArray":case "interceptor":case "cancellable":}});!F&&g&&(z=L.defer(),s.timeout=z.promise,e&&(J=M(z.resolve,e)));b&&(s.data=v);q.setUrlParams(s,p({},c(v,a.params||{}),G),a.url);var r=h(s).then(function(f){var c=f.data;if(c){if(O(c)!==!!a.isArray)throw B("badcfg",d,a.isArray?"array":"object",O(c)?"array":"object",s.method,s.url);if(a.isArray)n.length=0,t(c,function(a){"object"===typeof a?n.push(new l(a)):n.push(a)});else{var b=n.$promise;K(c,n);n.$promise=b}}f.resource=n;
|
|
||||||
return f}),r=r["finally"](function(){n.$resolved=!0;!F&&g&&(n.$cancelRequest=E,M.cancel(J),z=J=s.timeout=null)}),r=r.then(function(a){var d=C(a);(w||E)(d,a.headers,a.status,a.statusText);return d},H||I?function(a){H&&!I&&r.catch(E);H&&A(a);return I?x(a):L.reject(a)}:void 0);return F?r:(n.$promise=r,n.$resolved=!1,g&&(n.$cancelRequest=u),n)};l.prototype["$"+d]=function(a,c,b){y(a)&&(b=c,c=a,a={});a=l[d].call(this,a,this,c,b);return a.$promise||a}});l.bind=function(a){a=p({},e,a);return x(D,a,u,m)};
|
|
||||||
return l}var E=b.noop,t=b.forEach,p=b.extend,T=b.copy,O=b.isArray,N=b.isDefined,y=b.isFunction,S=b.isNumber,U=b.$$encodeUriQuery,V=b.$$encodeUriSegment;C.prototype={setUrlParams:function(b,e,g){var m=this,c=g||m.template,h,l,p="",a=m.urlParams=Object.create(null);t(c.split(/\W/),function(d){if("hasOwnProperty"===d)throw B("badname");!/^\d+$/.test(d)&&d&&(new RegExp("(^|[^\\\\]):"+d+"(\\W|$)")).test(c)&&(a[d]={isQueryParamValue:(new RegExp("\\?.*=:"+d+"(?:\\W|$)")).test(c)})});c=c.replace(/\\:/g,":");
|
|
||||||
c=c.replace(q,function(a){p=a;return""});e=e||{};t(m.urlParams,function(a,b){h=e.hasOwnProperty(b)?e[b]:m.defaults[b];N(h)&&null!==h?(l=a.isQueryParamValue?U(h,!0):V(h),c=c.replace(new RegExp(":"+b+"(\\W|$)","g"),function(a,b){return l+b})):c=c.replace(new RegExp("(/?):"+b+"(\\W|$)","g"),function(a,b,d){return"/"===d.charAt(0)?d:b+d})});m.defaults.stripTrailingSlashes&&(c=c.replace(/\/+$/,"")||"/");c=c.replace(/\/\.(?=\w+($|\?))/,".");b.url=p+c.replace(/\/(\\|%5C)\./,"/.");t(e,function(a,c){m.urlParams[c]||
|
|
||||||
(b.params=b.params||{},b.params[c]=a)})}};return x}]})})(window,window.angular);
|
|
||||||
//# sourceMappingURL=angular-resource.min.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-resource",
|
|
||||||
"version": "1.6.4",
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "./angular-resource.js",
|
|
||||||
"ignore": [],
|
|
||||||
"dependencies": {
|
|
||||||
"angular": "1.6.4"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
require('./angular-resource');
|
|
||||||
module.exports = 'ngResource';
|
|
|
@ -1,33 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-resource",
|
|
||||||
"version": "1.6.4",
|
|
||||||
"description": "AngularJS module for interacting with RESTful server-side data sources",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/angular/angular.js.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"angular",
|
|
||||||
"framework",
|
|
||||||
"browser",
|
|
||||||
"rest",
|
|
||||||
"client-side"
|
|
||||||
],
|
|
||||||
"author": "Angular Core Team <angular-core+npm@google.com>",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/angular/angular.js/issues"
|
|
||||||
},
|
|
||||||
"homepage": "http://angularjs.org",
|
|
||||||
"jspm": {
|
|
||||||
"shim": {
|
|
||||||
"angular-resource": {
|
|
||||||
"deps": ["angular"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2016 Angular
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -1,68 +0,0 @@
|
||||||
# packaged angular-route
|
|
||||||
|
|
||||||
This repo is for distribution on `npm` and `bower`. The source for this module is in the
|
|
||||||
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngRoute).
|
|
||||||
Please file issues and pull requests against that repo.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
You can install this package either with `npm` or with `bower`.
|
|
||||||
|
|
||||||
### npm
|
|
||||||
|
|
||||||
```shell
|
|
||||||
npm install angular-route
|
|
||||||
```
|
|
||||||
|
|
||||||
Then add `ngRoute` as a dependency for your app:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
angular.module('myApp', [require('angular-route')]);
|
|
||||||
```
|
|
||||||
|
|
||||||
### bower
|
|
||||||
|
|
||||||
```shell
|
|
||||||
bower install angular-route
|
|
||||||
```
|
|
||||||
|
|
||||||
Add a `<script>` to your `index.html`:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<script src="/bower_components/angular-route/angular-route.js"></script>
|
|
||||||
```
|
|
||||||
|
|
||||||
Then add `ngRoute` as a dependency for your app:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
angular.module('myApp', ['ngRoute']);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
Documentation is available on the
|
|
||||||
[AngularJS docs site](http://docs.angularjs.org/api/ngRoute).
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
The MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
AngularJS v1.6.4
|
|
||||||
(c) 2010-2017 Google, Inc. http://angularjs.org
|
|
||||||
License: MIT
|
|
||||||
*/
|
|
||||||
(function(J,d){'use strict';function A(d){k&&d.get("$route")}function B(t,u,g){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,f,b,c,m){function v(){l&&(g.cancel(l),l=null);n&&(n.$destroy(),n=null);p&&(l=g.leave(p),l.done(function(a){!1!==a&&(l=null)}),p=null)}function E(){var b=t.current&&t.current.locals;if(d.isDefined(b&&b.$template)){var b=a.$new(),c=t.current;p=m(b,function(b){g.enter(b,null,p||f).done(function(b){!1===b||!d.isDefined(w)||w&&!a.$eval(w)||u()});
|
|
||||||
v()});n=c.scope=b;n.$emit("$viewContentLoaded");n.$eval(k)}else v()}var n,p,l,w=b.autoscroll,k=b.onload||"";a.$on("$routeChangeSuccess",E);E()}}}function C(d,k,g){return{restrict:"ECA",priority:-400,link:function(a,f){var b=g.current,c=b.locals;f.html(c.$template);var m=d(f.contents());if(b.controller){c.$scope=a;var v=k(b.controller,c);b.controllerAs&&(a[b.controllerAs]=v);f.data("$ngControllerController",v);f.children().data("$ngControllerController",v)}a[b.resolveAs||"$resolve"]=c;m(a)}}}var x,
|
|
||||||
y,F,G,z=d.module("ngRoute",[]).info({angularVersion:"1.6.4"}).provider("$route",function(){function t(a,f){return d.extend(Object.create(a),f)}function u(a,d){var b=d.caseInsensitiveMatch,c={originalPath:a,regexp:a},g=c.keys=[];a=a.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)(\*\?|[?*])?/g,function(a,b,d,c){a="?"===c||"*?"===c?"?":null;c="*"===c||"*?"===c?"*":null;g.push({name:d,optional:!!a});b=b||"";return""+(a?"":b)+"(?:"+(a?b:"")+(c&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([/$*])/g,
|
|
||||||
"\\$1");c.regexp=new RegExp("^"+a+"$",b?"i":"");return c}x=d.isArray;y=d.isObject;F=d.isDefined;G=d.noop;var g={};this.when=function(a,f){var b;b=void 0;if(x(f)){b=b||[];for(var c=0,m=f.length;c<m;c++)b[c]=f[c]}else if(y(f))for(c in b=b||{},f)if("$"!==c.charAt(0)||"$"!==c.charAt(1))b[c]=f[c];b=b||f;d.isUndefined(b.reloadOnSearch)&&(b.reloadOnSearch=!0);d.isUndefined(b.caseInsensitiveMatch)&&(b.caseInsensitiveMatch=this.caseInsensitiveMatch);g[a]=d.extend(b,a&&u(a,b));a&&(c="/"===a[a.length-1]?a.substr(0,
|
|
||||||
a.length-1):a+"/",g[c]=d.extend({redirectTo:a},u(c,b)));return this};this.caseInsensitiveMatch=!1;this.otherwise=function(a){"string"===typeof a&&(a={redirectTo:a});this.when(null,a);return this};k=!0;this.eagerInstantiationEnabled=function(a){return F(a)?(k=a,this):k};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce","$browser",function(a,f,b,c,m,k,u,n){function p(e){var h=q.current;(y=(s=C())&&h&&s.$$route===h.$$route&&d.equals(s.pathParams,h.pathParams)&&
|
|
||||||
!s.reloadOnSearch&&!D)||!h&&!s||a.$broadcast("$routeChangeStart",s,h).defaultPrevented&&e&&e.preventDefault()}function l(){var e=q.current,h=s;if(y)e.params=h.params,d.copy(e.params,b),a.$broadcast("$routeUpdate",e);else if(h||e){D=!1;q.current=h;var H=c.resolve(h);n.$$incOutstandingRequestCount();H.then(w).then(z).then(function(c){return c&&H.then(A).then(function(c){h===q.current&&(h&&(h.locals=c,d.copy(h.params,b)),a.$broadcast("$routeChangeSuccess",h,e))})}).catch(function(b){h===q.current&&a.$broadcast("$routeChangeError",
|
|
||||||
h,e,b)}).finally(function(){n.$$completeOutstandingRequest(G)})}}function w(e){var a={route:e,hasRedirection:!1};if(e)if(e.redirectTo)if(d.isString(e.redirectTo))a.path=x(e.redirectTo,e.params),a.search=e.params,a.hasRedirection=!0;else{var b=f.path(),g=f.search();e=e.redirectTo(e.pathParams,b,g);d.isDefined(e)&&(a.url=e,a.hasRedirection=!0)}else if(e.resolveRedirectTo)return c.resolve(m.invoke(e.resolveRedirectTo)).then(function(e){d.isDefined(e)&&(a.url=e,a.hasRedirection=!0);return a});return a}
|
|
||||||
function z(a){var b=!0;if(a.route!==q.current)b=!1;else if(a.hasRedirection){var d=f.url(),c=a.url;c?f.url(c).replace():c=f.path(a.path).search(a.search).replace().url();c!==d&&(b=!1)}return b}function A(a){if(a){var b=d.extend({},a.resolve);d.forEach(b,function(a,e){b[e]=d.isString(a)?m.get(a):m.invoke(a,null,null,e)});a=B(a);d.isDefined(a)&&(b.$template=a);return c.all(b)}}function B(a){var b,c;d.isDefined(b=a.template)?d.isFunction(b)&&(b=b(a.params)):d.isDefined(c=a.templateUrl)&&(d.isFunction(c)&&
|
|
||||||
(c=c(a.params)),d.isDefined(c)&&(a.loadedTemplateUrl=u.valueOf(c),b=k(c)));return b}function C(){var a,b;d.forEach(g,function(c,g){var r;if(r=!b){var k=f.path();r=c.keys;var m={};if(c.regexp)if(k=c.regexp.exec(k)){for(var l=1,n=k.length;l<n;++l){var p=r[l-1],q=k[l];p&&q&&(m[p.name]=q)}r=m}else r=null;else r=null;r=a=r}r&&(b=t(c,{params:d.extend({},f.search(),a),pathParams:a}),b.$$route=c)});return b||g[null]&&t(g[null],{params:{},pathParams:{}})}function x(a,b){var c=[];d.forEach((a||"").split(":"),
|
|
||||||
function(a,d){if(0===d)c.push(a);else{var e=a.match(/(\w+)(?:[?*])?(.*)/),f=e[1];c.push(b[f]);c.push(e[2]||"");delete b[f]}});return c.join("")}var D=!1,s,y,q={routes:g,reload:function(){D=!0;var b={defaultPrevented:!1,preventDefault:function(){this.defaultPrevented=!0;D=!1}};a.$evalAsync(function(){p(b);b.defaultPrevented||l()})},updateParams:function(a){if(this.current&&this.current.$$route)a=d.extend({},this.current.params,a),f.path(x(this.current.$$route.originalPath,a)),f.search(a);else throw I("norout");
|
|
||||||
}};a.$on("$locationChangeStart",p);a.$on("$locationChangeSuccess",l);return q}]}).run(A),I=d.$$minErr("ngRoute"),k;A.$inject=["$injector"];z.provider("$routeParams",function(){this.$get=function(){return{}}});z.directive("ngView",B);z.directive("ngView",C);B.$inject=["$route","$anchorScroll","$animate"];C.$inject=["$compile","$controller","$route"]})(window,window.angular);
|
|
||||||
//# sourceMappingURL=angular-route.min.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-route",
|
|
||||||
"version": "1.6.4",
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "./angular-route.js",
|
|
||||||
"ignore": [],
|
|
||||||
"dependencies": {
|
|
||||||
"angular": "1.6.4"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
require('./angular-route');
|
|
||||||
module.exports = 'ngRoute';
|
|
|
@ -1,33 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-route",
|
|
||||||
"version": "1.6.4",
|
|
||||||
"description": "AngularJS router module",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/angular/angular.js.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"angular",
|
|
||||||
"framework",
|
|
||||||
"browser",
|
|
||||||
"router",
|
|
||||||
"client-side"
|
|
||||||
],
|
|
||||||
"author": "Angular Core Team <angular-core+npm@google.com>",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/angular/angular.js/issues"
|
|
||||||
},
|
|
||||||
"homepage": "http://angularjs.org",
|
|
||||||
"jspm": {
|
|
||||||
"shim": {
|
|
||||||
"angular-route": {
|
|
||||||
"deps": ["angular"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2016 Angular
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -1,68 +0,0 @@
|
||||||
# packaged angular-sanitize
|
|
||||||
|
|
||||||
This repo is for distribution on `npm` and `bower`. The source for this module is in the
|
|
||||||
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngSanitize).
|
|
||||||
Please file issues and pull requests against that repo.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
You can install this package either with `npm` or with `bower`.
|
|
||||||
|
|
||||||
### npm
|
|
||||||
|
|
||||||
```shell
|
|
||||||
npm install angular-sanitize
|
|
||||||
```
|
|
||||||
|
|
||||||
Then add `ngSanitize` as a dependency for your app:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
angular.module('myApp', [require('angular-sanitize')]);
|
|
||||||
```
|
|
||||||
|
|
||||||
### bower
|
|
||||||
|
|
||||||
```shell
|
|
||||||
bower install angular-sanitize
|
|
||||||
```
|
|
||||||
|
|
||||||
Add a `<script>` to your `index.html`:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<script src="/bower_components/angular-sanitize/angular-sanitize.js"></script>
|
|
||||||
```
|
|
||||||
|
|
||||||
Then add `ngSanitize` as a dependency for your app:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
angular.module('myApp', ['ngSanitize']);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
Documentation is available on the
|
|
||||||
[AngularJS docs site](http://docs.angularjs.org/api/ngSanitize).
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
The MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
|
@ -1,756 +0,0 @@
|
||||||
/**
|
|
||||||
* @license AngularJS v1.6.4
|
|
||||||
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
|
||||||
* License: MIT
|
|
||||||
*/
|
|
||||||
(function(window, angular) {'use strict';
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
* Any commits to this file should be reviewed with security in mind. *
|
|
||||||
* Changes to this file can potentially create security vulnerabilities. *
|
|
||||||
* An approval from 2 Core members with history of modifying *
|
|
||||||
* this file is required. *
|
|
||||||
* *
|
|
||||||
* Does the change somehow allow for arbitrary javascript to be executed? *
|
|
||||||
* Or allows for someone to change the prototype of built-in objects? *
|
|
||||||
* Or gives undesired access to variables likes document or window? *
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
|
|
||||||
var $sanitizeMinErr = angular.$$minErr('$sanitize');
|
|
||||||
var bind;
|
|
||||||
var extend;
|
|
||||||
var forEach;
|
|
||||||
var isDefined;
|
|
||||||
var lowercase;
|
|
||||||
var noop;
|
|
||||||
var nodeContains;
|
|
||||||
var htmlParser;
|
|
||||||
var htmlSanitizeWriter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc module
|
|
||||||
* @name ngSanitize
|
|
||||||
* @description
|
|
||||||
*
|
|
||||||
* # ngSanitize
|
|
||||||
*
|
|
||||||
* The `ngSanitize` module provides functionality to sanitize HTML.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* <div doc-module-components="ngSanitize"></div>
|
|
||||||
*
|
|
||||||
* See {@link ngSanitize.$sanitize `$sanitize`} for usage.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc service
|
|
||||||
* @name $sanitize
|
|
||||||
* @kind function
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Sanitizes an html string by stripping all potentially dangerous tokens.
|
|
||||||
*
|
|
||||||
* The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are
|
|
||||||
* then serialized back to properly escaped html string. This means that no unsafe input can make
|
|
||||||
* it into the returned string.
|
|
||||||
*
|
|
||||||
* The whitelist for URL sanitization of attribute values is configured using the functions
|
|
||||||
* `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider
|
|
||||||
* `$compileProvider`}.
|
|
||||||
*
|
|
||||||
* The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}.
|
|
||||||
*
|
|
||||||
* @param {string} html HTML input.
|
|
||||||
* @returns {string} Sanitized HTML.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
<example module="sanitizeExample" deps="angular-sanitize.js" name="sanitize-service">
|
|
||||||
<file name="index.html">
|
|
||||||
<script>
|
|
||||||
angular.module('sanitizeExample', ['ngSanitize'])
|
|
||||||
.controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
|
|
||||||
$scope.snippet =
|
|
||||||
'<p style="color:blue">an html\n' +
|
|
||||||
'<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
|
|
||||||
'snippet</p>';
|
|
||||||
$scope.deliberatelyTrustDangerousSnippet = function() {
|
|
||||||
return $sce.trustAsHtml($scope.snippet);
|
|
||||||
};
|
|
||||||
}]);
|
|
||||||
</script>
|
|
||||||
<div ng-controller="ExampleController">
|
|
||||||
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>Directive</td>
|
|
||||||
<td>How</td>
|
|
||||||
<td>Source</td>
|
|
||||||
<td>Rendered</td>
|
|
||||||
</tr>
|
|
||||||
<tr id="bind-html-with-sanitize">
|
|
||||||
<td>ng-bind-html</td>
|
|
||||||
<td>Automatically uses $sanitize</td>
|
|
||||||
<td><pre><div ng-bind-html="snippet"><br/></div></pre></td>
|
|
||||||
<td><div ng-bind-html="snippet"></div></td>
|
|
||||||
</tr>
|
|
||||||
<tr id="bind-html-with-trust">
|
|
||||||
<td>ng-bind-html</td>
|
|
||||||
<td>Bypass $sanitize by explicitly trusting the dangerous value</td>
|
|
||||||
<td>
|
|
||||||
<pre><div ng-bind-html="deliberatelyTrustDangerousSnippet()">
|
|
||||||
</div></pre>
|
|
||||||
</td>
|
|
||||||
<td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
|
|
||||||
</tr>
|
|
||||||
<tr id="bind-default">
|
|
||||||
<td>ng-bind</td>
|
|
||||||
<td>Automatically escapes</td>
|
|
||||||
<td><pre><div ng-bind="snippet"><br/></div></pre></td>
|
|
||||||
<td><div ng-bind="snippet"></div></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</file>
|
|
||||||
<file name="protractor.js" type="protractor">
|
|
||||||
it('should sanitize the html snippet by default', function() {
|
|
||||||
expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')).
|
|
||||||
toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should inline raw snippet if bound to a trusted value', function() {
|
|
||||||
expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).
|
|
||||||
toBe("<p style=\"color:blue\">an html\n" +
|
|
||||||
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
|
|
||||||
"snippet</p>");
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should escape snippet without any filter', function() {
|
|
||||||
expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).
|
|
||||||
toBe("<p style=\"color:blue\">an html\n" +
|
|
||||||
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
|
|
||||||
"snippet</p>");
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should update', function() {
|
|
||||||
element(by.model('snippet')).clear();
|
|
||||||
element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
|
|
||||||
expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')).
|
|
||||||
toBe('new <b>text</b>');
|
|
||||||
expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).toBe(
|
|
||||||
'new <b onclick="alert(1)">text</b>');
|
|
||||||
expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).toBe(
|
|
||||||
"new <b onclick=\"alert(1)\">text</b>");
|
|
||||||
});
|
|
||||||
</file>
|
|
||||||
</example>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc provider
|
|
||||||
* @name $sanitizeProvider
|
|
||||||
* @this
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Creates and configures {@link $sanitize} instance.
|
|
||||||
*/
|
|
||||||
function $SanitizeProvider() {
|
|
||||||
var svgEnabled = false;
|
|
||||||
|
|
||||||
this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
|
|
||||||
if (svgEnabled) {
|
|
||||||
extend(validElements, svgElements);
|
|
||||||
}
|
|
||||||
return function(html) {
|
|
||||||
var buf = [];
|
|
||||||
htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
|
|
||||||
return !/^unsafe:/.test($$sanitizeUri(uri, isImage));
|
|
||||||
}));
|
|
||||||
return buf.join('');
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc method
|
|
||||||
* @name $sanitizeProvider#enableSvg
|
|
||||||
* @kind function
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Enables a subset of svg to be supported by the sanitizer.
|
|
||||||
*
|
|
||||||
* <div class="alert alert-warning">
|
|
||||||
* <p>By enabling this setting without taking other precautions, you might expose your
|
|
||||||
* application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned
|
|
||||||
* outside of the containing element and be rendered over other elements on the page (e.g. a login
|
|
||||||
* link). Such behavior can then result in phishing incidents.</p>
|
|
||||||
*
|
|
||||||
* <p>To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg
|
|
||||||
* tags within the sanitized content:</p>
|
|
||||||
*
|
|
||||||
* <br>
|
|
||||||
*
|
|
||||||
* <pre><code>
|
|
||||||
* .rootOfTheIncludedContent svg {
|
|
||||||
* overflow: hidden !important;
|
|
||||||
* }
|
|
||||||
* </code></pre>
|
|
||||||
* </div>
|
|
||||||
*
|
|
||||||
* @param {boolean=} flag Enable or disable SVG support in the sanitizer.
|
|
||||||
* @returns {boolean|ng.$sanitizeProvider} Returns the currently configured value if called
|
|
||||||
* without an argument or self for chaining otherwise.
|
|
||||||
*/
|
|
||||||
this.enableSvg = function(enableSvg) {
|
|
||||||
if (isDefined(enableSvg)) {
|
|
||||||
svgEnabled = enableSvg;
|
|
||||||
return this;
|
|
||||||
} else {
|
|
||||||
return svgEnabled;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Private stuff
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bind = angular.bind;
|
|
||||||
extend = angular.extend;
|
|
||||||
forEach = angular.forEach;
|
|
||||||
isDefined = angular.isDefined;
|
|
||||||
lowercase = angular.lowercase;
|
|
||||||
noop = angular.noop;
|
|
||||||
|
|
||||||
htmlParser = htmlParserImpl;
|
|
||||||
htmlSanitizeWriter = htmlSanitizeWriterImpl;
|
|
||||||
|
|
||||||
nodeContains = window.Node.prototype.contains || /** @this */ function(arg) {
|
|
||||||
// eslint-disable-next-line no-bitwise
|
|
||||||
return !!(this.compareDocumentPosition(arg) & 16);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Regular Expressions for parsing tags and attributes
|
|
||||||
var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
|
|
||||||
// Match everything outside of normal chars and " (quote character)
|
|
||||||
NON_ALPHANUMERIC_REGEXP = /([^#-~ |!])/g;
|
|
||||||
|
|
||||||
|
|
||||||
// Good source of info about elements and attributes
|
|
||||||
// http://dev.w3.org/html5/spec/Overview.html#semantics
|
|
||||||
// http://simon.html5.org/html-elements
|
|
||||||
|
|
||||||
// Safe Void Elements - HTML5
|
|
||||||
// http://dev.w3.org/html5/spec/Overview.html#void-elements
|
|
||||||
var voidElements = toMap('area,br,col,hr,img,wbr');
|
|
||||||
|
|
||||||
// Elements that you can, intentionally, leave open (and which close themselves)
|
|
||||||
// http://dev.w3.org/html5/spec/Overview.html#optional-tags
|
|
||||||
var optionalEndTagBlockElements = toMap('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr'),
|
|
||||||
optionalEndTagInlineElements = toMap('rp,rt'),
|
|
||||||
optionalEndTagElements = extend({},
|
|
||||||
optionalEndTagInlineElements,
|
|
||||||
optionalEndTagBlockElements);
|
|
||||||
|
|
||||||
// Safe Block Elements - HTML5
|
|
||||||
var blockElements = extend({}, optionalEndTagBlockElements, toMap('address,article,' +
|
|
||||||
'aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
|
|
||||||
'h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul'));
|
|
||||||
|
|
||||||
// Inline Elements - HTML5
|
|
||||||
var inlineElements = extend({}, optionalEndTagInlineElements, toMap('a,abbr,acronym,b,' +
|
|
||||||
'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,' +
|
|
||||||
'samp,small,span,strike,strong,sub,sup,time,tt,u,var'));
|
|
||||||
|
|
||||||
// SVG Elements
|
|
||||||
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements
|
|
||||||
// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.
|
|
||||||
// They can potentially allow for arbitrary javascript to be executed. See #11290
|
|
||||||
var svgElements = toMap('circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,' +
|
|
||||||
'hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,' +
|
|
||||||
'radialGradient,rect,stop,svg,switch,text,title,tspan');
|
|
||||||
|
|
||||||
// Blocked Elements (will be stripped)
|
|
||||||
var blockedElements = toMap('script,style');
|
|
||||||
|
|
||||||
var validElements = extend({},
|
|
||||||
voidElements,
|
|
||||||
blockElements,
|
|
||||||
inlineElements,
|
|
||||||
optionalEndTagElements);
|
|
||||||
|
|
||||||
//Attributes that have href and hence need to be sanitized
|
|
||||||
var uriAttrs = toMap('background,cite,href,longdesc,src,xlink:href');
|
|
||||||
|
|
||||||
var htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +
|
|
||||||
'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +
|
|
||||||
'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +
|
|
||||||
'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +
|
|
||||||
'valign,value,vspace,width');
|
|
||||||
|
|
||||||
// SVG attributes (without "id" and "name" attributes)
|
|
||||||
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes
|
|
||||||
var svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +
|
|
||||||
'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +
|
|
||||||
'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +
|
|
||||||
'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +
|
|
||||||
'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +
|
|
||||||
'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +
|
|
||||||
'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +
|
|
||||||
'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +
|
|
||||||
'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +
|
|
||||||
'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +
|
|
||||||
'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +
|
|
||||||
'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +
|
|
||||||
'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +
|
|
||||||
'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +
|
|
||||||
'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);
|
|
||||||
|
|
||||||
var validAttrs = extend({},
|
|
||||||
uriAttrs,
|
|
||||||
svgAttrs,
|
|
||||||
htmlAttrs);
|
|
||||||
|
|
||||||
function toMap(str, lowercaseKeys) {
|
|
||||||
var obj = {}, items = str.split(','), i;
|
|
||||||
for (i = 0; i < items.length; i++) {
|
|
||||||
obj[lowercaseKeys ? lowercase(items[i]) : items[i]] = true;
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
var inertBodyElement;
|
|
||||||
(function(window) {
|
|
||||||
var doc;
|
|
||||||
if (window.document && window.document.implementation) {
|
|
||||||
doc = window.document.implementation.createHTMLDocument('inert');
|
|
||||||
} else {
|
|
||||||
throw $sanitizeMinErr('noinert', 'Can\'t create an inert html document');
|
|
||||||
}
|
|
||||||
var docElement = doc.documentElement || doc.getDocumentElement();
|
|
||||||
var bodyElements = docElement.getElementsByTagName('body');
|
|
||||||
|
|
||||||
// usually there should be only one body element in the document, but IE doesn't have any, so we need to create one
|
|
||||||
if (bodyElements.length === 1) {
|
|
||||||
inertBodyElement = bodyElements[0];
|
|
||||||
} else {
|
|
||||||
var html = doc.createElement('html');
|
|
||||||
inertBodyElement = doc.createElement('body');
|
|
||||||
html.appendChild(inertBodyElement);
|
|
||||||
doc.appendChild(html);
|
|
||||||
}
|
|
||||||
})(window);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @example
|
|
||||||
* htmlParser(htmlString, {
|
|
||||||
* start: function(tag, attrs) {},
|
|
||||||
* end: function(tag) {},
|
|
||||||
* chars: function(text) {},
|
|
||||||
* comment: function(text) {}
|
|
||||||
* });
|
|
||||||
*
|
|
||||||
* @param {string} html string
|
|
||||||
* @param {object} handler
|
|
||||||
*/
|
|
||||||
function htmlParserImpl(html, handler) {
|
|
||||||
if (html === null || html === undefined) {
|
|
||||||
html = '';
|
|
||||||
} else if (typeof html !== 'string') {
|
|
||||||
html = '' + html;
|
|
||||||
}
|
|
||||||
inertBodyElement.innerHTML = html;
|
|
||||||
|
|
||||||
//mXSS protection
|
|
||||||
var mXSSAttempts = 5;
|
|
||||||
do {
|
|
||||||
if (mXSSAttempts === 0) {
|
|
||||||
throw $sanitizeMinErr('uinput', 'Failed to sanitize html because the input is unstable');
|
|
||||||
}
|
|
||||||
mXSSAttempts--;
|
|
||||||
|
|
||||||
// strip custom-namespaced attributes on IE<=11
|
|
||||||
if (window.document.documentMode) {
|
|
||||||
stripCustomNsAttrs(inertBodyElement);
|
|
||||||
}
|
|
||||||
html = inertBodyElement.innerHTML; //trigger mXSS
|
|
||||||
inertBodyElement.innerHTML = html;
|
|
||||||
} while (html !== inertBodyElement.innerHTML);
|
|
||||||
|
|
||||||
var node = inertBodyElement.firstChild;
|
|
||||||
while (node) {
|
|
||||||
switch (node.nodeType) {
|
|
||||||
case 1: // ELEMENT_NODE
|
|
||||||
handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));
|
|
||||||
break;
|
|
||||||
case 3: // TEXT NODE
|
|
||||||
handler.chars(node.textContent);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var nextNode;
|
|
||||||
if (!(nextNode = node.firstChild)) {
|
|
||||||
if (node.nodeType === 1) {
|
|
||||||
handler.end(node.nodeName.toLowerCase());
|
|
||||||
}
|
|
||||||
nextNode = getNonDescendant('nextSibling', node);
|
|
||||||
if (!nextNode) {
|
|
||||||
while (nextNode == null) {
|
|
||||||
node = getNonDescendant('parentNode', node);
|
|
||||||
if (node === inertBodyElement) break;
|
|
||||||
nextNode = getNonDescendant('nextSibling', node);
|
|
||||||
if (node.nodeType === 1) {
|
|
||||||
handler.end(node.nodeName.toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
node = nextNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((node = inertBodyElement.firstChild)) {
|
|
||||||
inertBodyElement.removeChild(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function attrToMap(attrs) {
|
|
||||||
var map = {};
|
|
||||||
for (var i = 0, ii = attrs.length; i < ii; i++) {
|
|
||||||
var attr = attrs[i];
|
|
||||||
map[attr.name] = attr.value;
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Escapes all potentially dangerous characters, so that the
|
|
||||||
* resulting string can be safely inserted into attribute or
|
|
||||||
* element text.
|
|
||||||
* @param value
|
|
||||||
* @returns {string} escaped text
|
|
||||||
*/
|
|
||||||
function encodeEntities(value) {
|
|
||||||
return value.
|
|
||||||
replace(/&/g, '&').
|
|
||||||
replace(SURROGATE_PAIR_REGEXP, function(value) {
|
|
||||||
var hi = value.charCodeAt(0);
|
|
||||||
var low = value.charCodeAt(1);
|
|
||||||
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
|
|
||||||
}).
|
|
||||||
replace(NON_ALPHANUMERIC_REGEXP, function(value) {
|
|
||||||
return '&#' + value.charCodeAt(0) + ';';
|
|
||||||
}).
|
|
||||||
replace(/</g, '<').
|
|
||||||
replace(/>/g, '>');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* create an HTML/XML writer which writes to buffer
|
|
||||||
* @param {Array} buf use buf.join('') to get out sanitized html string
|
|
||||||
* @returns {object} in the form of {
|
|
||||||
* start: function(tag, attrs) {},
|
|
||||||
* end: function(tag) {},
|
|
||||||
* chars: function(text) {},
|
|
||||||
* comment: function(text) {}
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
function htmlSanitizeWriterImpl(buf, uriValidator) {
|
|
||||||
var ignoreCurrentElement = false;
|
|
||||||
var out = bind(buf, buf.push);
|
|
||||||
return {
|
|
||||||
start: function(tag, attrs) {
|
|
||||||
tag = lowercase(tag);
|
|
||||||
if (!ignoreCurrentElement && blockedElements[tag]) {
|
|
||||||
ignoreCurrentElement = tag;
|
|
||||||
}
|
|
||||||
if (!ignoreCurrentElement && validElements[tag] === true) {
|
|
||||||
out('<');
|
|
||||||
out(tag);
|
|
||||||
forEach(attrs, function(value, key) {
|
|
||||||
var lkey = lowercase(key);
|
|
||||||
var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
|
|
||||||
if (validAttrs[lkey] === true &&
|
|
||||||
(uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
|
|
||||||
out(' ');
|
|
||||||
out(key);
|
|
||||||
out('="');
|
|
||||||
out(encodeEntities(value));
|
|
||||||
out('"');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
out('>');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
end: function(tag) {
|
|
||||||
tag = lowercase(tag);
|
|
||||||
if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {
|
|
||||||
out('</');
|
|
||||||
out(tag);
|
|
||||||
out('>');
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line eqeqeq
|
|
||||||
if (tag == ignoreCurrentElement) {
|
|
||||||
ignoreCurrentElement = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
chars: function(chars) {
|
|
||||||
if (!ignoreCurrentElement) {
|
|
||||||
out(encodeEntities(chars));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare
|
|
||||||
* ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want
|
|
||||||
* to allow any of these custom attributes. This method strips them all.
|
|
||||||
*
|
|
||||||
* @param node Root element to process
|
|
||||||
*/
|
|
||||||
function stripCustomNsAttrs(node) {
|
|
||||||
while (node) {
|
|
||||||
if (node.nodeType === window.Node.ELEMENT_NODE) {
|
|
||||||
var attrs = node.attributes;
|
|
||||||
for (var i = 0, l = attrs.length; i < l; i++) {
|
|
||||||
var attrNode = attrs[i];
|
|
||||||
var attrName = attrNode.name.toLowerCase();
|
|
||||||
if (attrName === 'xmlns:ns1' || attrName.lastIndexOf('ns1:', 0) === 0) {
|
|
||||||
node.removeAttributeNode(attrNode);
|
|
||||||
i--;
|
|
||||||
l--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var nextNode = node.firstChild;
|
|
||||||
if (nextNode) {
|
|
||||||
stripCustomNsAttrs(nextNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
node = getNonDescendant('nextSibling', node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getNonDescendant(propName, node) {
|
|
||||||
// An element is clobbered if its `propName` property points to one of its descendants
|
|
||||||
var nextNode = node[propName];
|
|
||||||
if (nextNode && nodeContains.call(node, nextNode)) {
|
|
||||||
throw $sanitizeMinErr('elclob', 'Failed to sanitize html because the element is clobbered: {0}', node.outerHTML || node.outerText);
|
|
||||||
}
|
|
||||||
return nextNode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function sanitizeText(chars) {
|
|
||||||
var buf = [];
|
|
||||||
var writer = htmlSanitizeWriter(buf, noop);
|
|
||||||
writer.chars(chars);
|
|
||||||
return buf.join('');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// define ngSanitize module and register $sanitize service
|
|
||||||
angular.module('ngSanitize', [])
|
|
||||||
.provider('$sanitize', $SanitizeProvider)
|
|
||||||
.info({ angularVersion: '1.6.4' });
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc filter
|
|
||||||
* @name linky
|
|
||||||
* @kind function
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and
|
|
||||||
* plain email address links.
|
|
||||||
*
|
|
||||||
* Requires the {@link ngSanitize `ngSanitize`} module to be installed.
|
|
||||||
*
|
|
||||||
* @param {string} text Input text.
|
|
||||||
* @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in.
|
|
||||||
* @param {object|function(url)} [attributes] Add custom attributes to the link element.
|
|
||||||
*
|
|
||||||
* Can be one of:
|
|
||||||
*
|
|
||||||
* - `object`: A map of attributes
|
|
||||||
* - `function`: Takes the url as a parameter and returns a map of attributes
|
|
||||||
*
|
|
||||||
* If the map of attributes contains a value for `target`, it overrides the value of
|
|
||||||
* the target parameter.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @returns {string} Html-linkified and {@link $sanitize sanitized} text.
|
|
||||||
*
|
|
||||||
* @usage
|
|
||||||
<span ng-bind-html="linky_expression | linky"></span>
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
<example module="linkyExample" deps="angular-sanitize.js" name="linky-filter">
|
|
||||||
<file name="index.html">
|
|
||||||
<div ng-controller="ExampleController">
|
|
||||||
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>Filter</th>
|
|
||||||
<th>Source</th>
|
|
||||||
<th>Rendered</th>
|
|
||||||
</tr>
|
|
||||||
<tr id="linky-filter">
|
|
||||||
<td>linky filter</td>
|
|
||||||
<td>
|
|
||||||
<pre><div ng-bind-html="snippet | linky"><br></div></pre>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div ng-bind-html="snippet | linky"></div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr id="linky-target">
|
|
||||||
<td>linky target</td>
|
|
||||||
<td>
|
|
||||||
<pre><div ng-bind-html="snippetWithSingleURL | linky:'_blank'"><br></div></pre>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div ng-bind-html="snippetWithSingleURL | linky:'_blank'"></div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr id="linky-custom-attributes">
|
|
||||||
<td>linky custom attributes</td>
|
|
||||||
<td>
|
|
||||||
<pre><div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"><br></div></pre>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"></div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr id="escaped-html">
|
|
||||||
<td>no filter</td>
|
|
||||||
<td><pre><div ng-bind="snippet"><br></div></pre></td>
|
|
||||||
<td><div ng-bind="snippet"></div></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</file>
|
|
||||||
<file name="script.js">
|
|
||||||
angular.module('linkyExample', ['ngSanitize'])
|
|
||||||
.controller('ExampleController', ['$scope', function($scope) {
|
|
||||||
$scope.snippet =
|
|
||||||
'Pretty text with some links:\n' +
|
|
||||||
'http://angularjs.org/,\n' +
|
|
||||||
'mailto:us@somewhere.org,\n' +
|
|
||||||
'another@somewhere.org,\n' +
|
|
||||||
'and one more: ftp://127.0.0.1/.';
|
|
||||||
$scope.snippetWithSingleURL = 'http://angularjs.org/';
|
|
||||||
}]);
|
|
||||||
</file>
|
|
||||||
<file name="protractor.js" type="protractor">
|
|
||||||
it('should linkify the snippet with urls', function() {
|
|
||||||
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
|
|
||||||
toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +
|
|
||||||
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
|
|
||||||
expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not linkify snippet without the linky filter', function() {
|
|
||||||
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
|
|
||||||
toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +
|
|
||||||
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
|
|
||||||
expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should update', function() {
|
|
||||||
element(by.model('snippet')).clear();
|
|
||||||
element(by.model('snippet')).sendKeys('new http://link.');
|
|
||||||
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
|
|
||||||
toBe('new http://link.');
|
|
||||||
expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
|
|
||||||
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
|
|
||||||
.toBe('new http://link.');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should work with the target property', function() {
|
|
||||||
expect(element(by.id('linky-target')).
|
|
||||||
element(by.binding("snippetWithSingleURL | linky:'_blank'")).getText()).
|
|
||||||
toBe('http://angularjs.org/');
|
|
||||||
expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should optionally add custom attributes', function() {
|
|
||||||
expect(element(by.id('linky-custom-attributes')).
|
|
||||||
element(by.binding("snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}")).getText()).
|
|
||||||
toBe('http://angularjs.org/');
|
|
||||||
expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow');
|
|
||||||
});
|
|
||||||
</file>
|
|
||||||
</example>
|
|
||||||
*/
|
|
||||||
angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
|
|
||||||
var LINKY_URL_REGEXP =
|
|
||||||
/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
|
|
||||||
MAILTO_REGEXP = /^mailto:/i;
|
|
||||||
|
|
||||||
var linkyMinErr = angular.$$minErr('linky');
|
|
||||||
var isDefined = angular.isDefined;
|
|
||||||
var isFunction = angular.isFunction;
|
|
||||||
var isObject = angular.isObject;
|
|
||||||
var isString = angular.isString;
|
|
||||||
|
|
||||||
return function(text, target, attributes) {
|
|
||||||
if (text == null || text === '') return text;
|
|
||||||
if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);
|
|
||||||
|
|
||||||
var attributesFn =
|
|
||||||
isFunction(attributes) ? attributes :
|
|
||||||
isObject(attributes) ? function getAttributesObject() {return attributes;} :
|
|
||||||
function getEmptyAttributesObject() {return {};};
|
|
||||||
|
|
||||||
var match;
|
|
||||||
var raw = text;
|
|
||||||
var html = [];
|
|
||||||
var url;
|
|
||||||
var i;
|
|
||||||
while ((match = raw.match(LINKY_URL_REGEXP))) {
|
|
||||||
// We can not end in these as they are sometimes found at the end of the sentence
|
|
||||||
url = match[0];
|
|
||||||
// if we did not match ftp/http/www/mailto then assume mailto
|
|
||||||
if (!match[2] && !match[4]) {
|
|
||||||
url = (match[3] ? 'http://' : 'mailto:') + url;
|
|
||||||
}
|
|
||||||
i = match.index;
|
|
||||||
addText(raw.substr(0, i));
|
|
||||||
addLink(url, match[0].replace(MAILTO_REGEXP, ''));
|
|
||||||
raw = raw.substring(i + match[0].length);
|
|
||||||
}
|
|
||||||
addText(raw);
|
|
||||||
return $sanitize(html.join(''));
|
|
||||||
|
|
||||||
function addText(text) {
|
|
||||||
if (!text) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
html.push(sanitizeText(text));
|
|
||||||
}
|
|
||||||
|
|
||||||
function addLink(url, text) {
|
|
||||||
var key, linkAttributes = attributesFn(url);
|
|
||||||
html.push('<a ');
|
|
||||||
|
|
||||||
for (key in linkAttributes) {
|
|
||||||
html.push(key + '="' + linkAttributes[key] + '" ');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDefined(target) && !('target' in linkAttributes)) {
|
|
||||||
html.push('target="',
|
|
||||||
target,
|
|
||||||
'" ');
|
|
||||||
}
|
|
||||||
html.push('href="',
|
|
||||||
url.replace(/"/g, '"'),
|
|
||||||
'">');
|
|
||||||
addText(text);
|
|
||||||
html.push('</a>');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}]);
|
|
||||||
|
|
||||||
|
|
||||||
})(window, window.angular);
|
|
|
@ -1,16 +0,0 @@
|
||||||
/*
|
|
||||||
AngularJS v1.6.4
|
|
||||||
(c) 2010-2017 Google, Inc. http://angularjs.org
|
|
||||||
License: MIT
|
|
||||||
*/
|
|
||||||
(function(s,f){'use strict';function J(f){var k=[];v(k,B).chars(f);return k.join("")}var w=f.$$minErr("$sanitize"),C,k,D,E,q,B,F,G,v;f.module("ngSanitize",[]).provider("$sanitize",function(){function h(a,c){var b={},d=a.split(","),l;for(l=0;l<d.length;l++)b[c?q(d[l]):d[l]]=!0;return b}function K(a){for(var c={},b=0,d=a.length;b<d;b++){var l=a[b];c[l.name]=l.value}return c}function H(a){return a.replace(/&/g,"&").replace(L,function(a){var b=a.charCodeAt(0);a=a.charCodeAt(1);return"&#"+(1024*(b-
|
|
||||||
55296)+(a-56320)+65536)+";"}).replace(M,function(a){return"&#"+a.charCodeAt(0)+";"}).replace(/</g,"<").replace(/>/g,">")}function I(a){for(;a;){if(a.nodeType===s.Node.ELEMENT_NODE)for(var c=a.attributes,b=0,d=c.length;b<d;b++){var l=c[b],e=l.name.toLowerCase();if("xmlns:ns1"===e||0===e.lastIndexOf("ns1:",0))a.removeAttributeNode(l),b--,d--}(c=a.firstChild)&&I(c);a=t("nextSibling",a)}}function t(a,c){var b=c[a];if(b&&F.call(c,b))throw w("elclob",c.outerHTML||c.outerText);return b}var x=!1;this.$get=
|
|
||||||
["$$sanitizeUri",function(a){x&&k(p,z);return function(c){var b=[];G(c,v(b,function(b,c){return!/^unsafe:/.test(a(b,c))}));return b.join("")}}];this.enableSvg=function(a){return E(a)?(x=a,this):x};C=f.bind;k=f.extend;D=f.forEach;E=f.isDefined;q=f.lowercase;B=f.noop;G=function(a,c){null===a||void 0===a?a="":"string"!==typeof a&&(a=""+a);g.innerHTML=a;var b=5;do{if(0===b)throw w("uinput");b--;s.document.documentMode&&I(g);a=g.innerHTML;g.innerHTML=a}while(a!==g.innerHTML);for(b=g.firstChild;b;){switch(b.nodeType){case 1:c.start(b.nodeName.toLowerCase(),
|
|
||||||
K(b.attributes));break;case 3:c.chars(b.textContent)}var d;if(!(d=b.firstChild)&&(1===b.nodeType&&c.end(b.nodeName.toLowerCase()),d=t("nextSibling",b),!d))for(;null==d;){b=t("parentNode",b);if(b===g)break;d=t("nextSibling",b);1===b.nodeType&&c.end(b.nodeName.toLowerCase())}b=d}for(;b=g.firstChild;)g.removeChild(b)};v=function(a,c){var b=!1,d=C(a,a.push);return{start:function(a,e){a=q(a);!b&&A[a]&&(b=a);b||!0!==p[a]||(d("<"),d(a),D(e,function(b,e){var f=q(e),g="img"===a&&"src"===f||"background"===
|
|
||||||
f;!0!==u[f]||!0===n[f]&&!c(b,g)||(d(" "),d(e),d('="'),d(H(b)),d('"'))}),d(">"))},end:function(a){a=q(a);b||!0!==p[a]||!0===e[a]||(d("</"),d(a),d(">"));a==b&&(b=!1)},chars:function(a){b||d(H(a))}}};F=s.Node.prototype.contains||function(a){return!!(this.compareDocumentPosition(a)&16)};var L=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,M=/([^#-~ |!])/g,e=h("area,br,col,hr,img,wbr"),y=h("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),m=h("rp,rt"),r=k({},m,y),y=k({},y,h("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul")),
|
|
||||||
m=k({},m,h("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),z=h("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,stop,svg,switch,text,title,tspan"),A=h("script,style"),p=k({},e,y,m,r),n=h("background,cite,href,longdesc,src,xlink:href"),r=h("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,valign,value,vspace,width"),
|
|
||||||
m=h("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan",
|
|
||||||
!0),u=k({},n,m,r),g;(function(a){if(a.document&&a.document.implementation)a=a.document.implementation.createHTMLDocument("inert");else throw w("noinert");var c=(a.documentElement||a.getDocumentElement()).getElementsByTagName("body");1===c.length?g=c[0]:(c=a.createElement("html"),g=a.createElement("body"),c.appendChild(g),a.appendChild(c))})(s)}).info({angularVersion:"1.6.4"});f.module("ngSanitize").filter("linky",["$sanitize",function(h){var k=/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
|
|
||||||
q=/^mailto:/i,s=f.$$minErr("linky"),t=f.isDefined,x=f.isFunction,v=f.isObject,w=f.isString;return function(e,f,m){function r(a){a&&n.push(J(a))}function z(a,c){var b,d=A(a);n.push("<a ");for(b in d)n.push(b+'="'+d[b]+'" ');!t(f)||"target"in d||n.push('target="',f,'" ');n.push('href="',a.replace(/"/g,"""),'">');r(c);n.push("</a>")}if(null==e||""===e)return e;if(!w(e))throw s("notstring",e);for(var A=x(m)?m:v(m)?function(){return m}:function(){return{}},p=e,n=[],u,g;e=p.match(k);)u=e[0],e[2]||
|
|
||||||
e[4]||(u=(e[3]?"http://":"mailto:")+u),g=e.index,r(p.substr(0,g)),z(u,e[0].replace(q,"")),p=p.substring(g+e[0].length);r(p);return h(n.join(""))}}])})(window,window.angular);
|
|
||||||
//# sourceMappingURL=angular-sanitize.min.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-sanitize",
|
|
||||||
"version": "1.6.4",
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "./angular-sanitize.js",
|
|
||||||
"ignore": [],
|
|
||||||
"dependencies": {
|
|
||||||
"angular": "1.6.4"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
require('./angular-sanitize');
|
|
||||||
module.exports = 'ngSanitize';
|
|
|
@ -1,33 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-sanitize",
|
|
||||||
"version": "1.6.4",
|
|
||||||
"description": "AngularJS module for sanitizing HTML",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/angular/angular.js.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"angular",
|
|
||||||
"framework",
|
|
||||||
"browser",
|
|
||||||
"html",
|
|
||||||
"client-side"
|
|
||||||
],
|
|
||||||
"author": "Angular Core Team <angular-core+npm@google.com>",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/angular/angular.js/issues"
|
|
||||||
},
|
|
||||||
"homepage": "http://angularjs.org",
|
|
||||||
"jspm": {
|
|
||||||
"shim": {
|
|
||||||
"angular-sanitize": {
|
|
||||||
"deps": ["angular"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
# angular-translate-loader-url (bower shadow repository)
|
|
||||||
|
|
||||||
This is the _Bower shadow_ repository for *angular-translate-loader-url*.
|
|
||||||
|
|
||||||
## Bugs and issues
|
|
||||||
|
|
||||||
Please file any issues and bugs in our main repository at [angular-translate/angular-translate](https://github.com/angular-translate/angular-translate/issues).
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### via Bower
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ bower install angular-translate-loader-url
|
|
||||||
```
|
|
||||||
|
|
||||||
### via NPM
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ npm install angular-translate-loader-url
|
|
||||||
```
|
|
||||||
|
|
||||||
### via cdnjs
|
|
||||||
|
|
||||||
Please have a look at https://cdnjs.com/libraries/angular-translate-loader-url for specific versions.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
Licensed under MIT. See more details at [angular-translate/angular-translate](https://github.com/angular-translate/angular-translate).
|
|
|
@ -1,73 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 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';
|
|
||||||
|
|
||||||
}));
|
|
|
@ -1,6 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
|
||||||
*/
|
|
||||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a,b){"use strict";return function(c){if(!c||!c.url)throw new Error("Couldn't use urlLoader since no url is given!");var d={};return d[c.queryParameter||"lang"]=c.key,b(angular.extend({url:c.url,params:d,method:"GET"},c.$http)).then(function(a){return a.data},function(){return a.reject(c.key)})}}return a.$inject=["$q","$http"],angular.module("pascalprecht.translate").factory("$translateUrlLoader",a),a.displayName="$translateUrlLoader","pascalprecht.translate"});
|
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-translate-loader-url",
|
|
||||||
"description": "A plugin for Angular Translate",
|
|
||||||
"version": "2.15.1",
|
|
||||||
"main": "./angular-translate-loader-url.js",
|
|
||||||
"ignore": [],
|
|
||||||
"author": "Pascal Precht",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"angular-translate": "~2.15.1"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-translate-loader-url",
|
|
||||||
"version": "2.15.1",
|
|
||||||
"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.",
|
|
||||||
"main": "angular-translate-loader-url.js",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/angular-translate/bower-angular-translate-loader-url.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"angular",
|
|
||||||
"translate",
|
|
||||||
"loader"
|
|
||||||
],
|
|
||||||
"author": "Pascal Precht",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/angular-translate/angular-translate/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://angular-translate.github.io",
|
|
||||||
"dependencies": {
|
|
||||||
"angular-translate": "~2.15.1"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
/bower_components/
|
|
||||||
/build_tools/
|
|
||||||
/demo/
|
|
||||||
/docs/
|
|
||||||
/identity/
|
|
||||||
/src/
|
|
||||||
/test/
|
|
||||||
/test_scopes/
|
|
||||||
/tmp
|
|
||||||
/.bowerrc
|
|
||||||
/.editorconfig
|
|
||||||
/.jshintrc
|
|
||||||
/.github
|
|
||||||
/.travis.yml
|
|
||||||
/bower.json
|
|
||||||
/CONTRIBUTING.md
|
|
||||||
/*.sh
|
|
||||||
/*.js
|
|
||||||
/*.png
|
|
||||||
/build/
|
|
||||||
|
|
||||||
# IntelliJ stuff
|
|
||||||
.idea
|
|
||||||
*.iml
|
|
||||||
# Eclipse (plugins)
|
|
||||||
/atlassian-ide-plugin.xml
|
|
|
@ -1 +0,0 @@
|
||||||
6.9
|
|
|
@ -1,916 +0,0 @@
|
||||||
<a name="2.15.1"></a>
|
|
||||||
## [2.15.1](https://github.com/angular-translate/angular-translate/compare/2.15.0...v2.15.1) (2017-03-04)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **cloak:** fix missing decloak introduced by optimize [#1694](https://github.com/angular-translate/angular-translate/issues/1694) ([a9ec123](https://github.com/angular-translate/angular-translate/commit/a9ec123)), closes [#1705](https://github.com/angular-translate/angular-translate/issues/1705)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.15.0"></a>
|
|
||||||
# [2.15.0](https://github.com/angular-translate/angular-translate/compare/2.14.0...v2.15.0) (2017-02-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **cookies:** use $cookies (1.4+) or $cookieStore (<1.4) ([51330f5](https://github.com/angular-translate/angular-translate/commit/51330f5))
|
|
||||||
* **filter:** ensure no this==undefined will be injected ([5cb94cb](https://github.com/angular-translate/angular-translate/commit/5cb94cb))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.14.0"></a>
|
|
||||||
# [2.14.0](https://github.com/angular-translate/angular-translate/compare/2.13.1...v2.14.0) (2017-02-11)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **$translate:** reassign language promises in refresh, update translation tables at the appropriate time, and simplify the routine ([351eb8f](https://github.com/angular-translate/angular-translate/commit/351eb8f))
|
|
||||||
* **$translatePartialLoader:** prevent duplicate simultaneous HTTP requests ([8b2cea8](https://github.com/angular-translate/angular-translate/commit/8b2cea8))
|
|
||||||
* **service:** add explicit promise rejection handler for $translate.use ([f4dc14a](https://github.com/angular-translate/angular-translate/commit/f4dc14a))
|
|
||||||
* **service:** avoid sanitize/esape calls on null/undefined param values ([331e0dd](https://github.com/angular-translate/angular-translate/commit/331e0dd))
|
|
||||||
* **service:** fix missing promise rejection handlers ([776993b](https://github.com/angular-translate/angular-translate/commit/776993b))
|
|
||||||
* **staticFilesLoader:** do not use empty string as $http params ([ac2a038](https://github.com/angular-translate/angular-translate/commit/ac2a038)), closes [#1646](https://github.com/angular-translate/angular-translate/issues/1646)
|
|
||||||
* **tests:** rewrite tests for AJS 1.6 compatibility ([7c9d2c9](https://github.com/angular-translate/angular-translate/commit/7c9d2c9))
|
|
||||||
* **translate:** handle null translation ([1e57b4f](https://github.com/angular-translate/angular-translate/commit/1e57b4f)), closes [#665](https://github.com/angular-translate/angular-translate/issues/665)
|
|
||||||
* **translateCloak:** incorrect element reference, inappropriate decloak at onReady, inappropriate decloak at $translateChangeSuccess ([a4d2795](https://github.com/angular-translate/angular-translate/commit/a4d2795))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **dependencies:** update to messageformat 1.0.2 ([d4a0468](https://github.com/angular-translate/angular-translate/commit/d4a0468))
|
|
||||||
* **service:** add translationId as param of custom interpolation service interface ([5de40de](https://github.com/angular-translate/angular-translate/commit/5de40de))
|
|
||||||
* **tests:** add current AngularJS 1.6 in test scopes ([d8abdc5](https://github.com/angular-translate/angular-translate/commit/d8abdc5))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.13.1"></a>
|
|
||||||
## [2.13.1](https://github.com/angular-translate/angular-translate/compare/2.13.0...v2.13.1) (2016-12-06)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.13.0"></a>
|
|
||||||
# [2.13.0](https://github.com/angular-translate/angular-translate/compare/2.12.1...v2.13.0) (2016-10-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **service:** fix .instant() not handling TrustedValueHolderType correctly ([1ede55e](https://github.com/angular-translate/angular-translate/commit/1ede55e)), closes [#1618](https://github.com/angular-translate/angular-translate/issues/1618)
|
|
||||||
* **service:** reject promise if handler returns undefined ([8fe6f23](https://github.com/angular-translate/angular-translate/commit/8fe6f23)), closes [#1600](https://github.com/angular-translate/angular-translate/issues/1600)
|
|
||||||
* **service:** return empty string when found in fallback ([d76227e](https://github.com/angular-translate/angular-translate/commit/d76227e))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **sanitize:** sanitize override on instant call ([01fecd0](https://github.com/angular-translate/angular-translate/commit/01fecd0))
|
|
||||||
* **service:** add $translate.getTranslationTable(langKey) ([40f9e35](https://github.com/angular-translate/angular-translate/commit/40f9e35))
|
|
||||||
* **service:** add file map lookup into static-files loader ([132e49a](https://github.com/angular-translate/angular-translate/commit/132e49a))
|
|
||||||
* **service:** add mf configurer [#1619](https://github.com/angular-translate/angular-translate/issues/1619) ([676114b](https://github.com/angular-translate/angular-translate/commit/676114b))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.12.1"></a>
|
|
||||||
## [2.12.1](https://github.com/angular-translate/angular-translate/compare/2.12.0...v2.12.1) (2016-09-15)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **build:** Add missing translate-attr directive to Gruntfile.js ([e70e9ad](https://github.com/angular-translate/angular-translate/commit/e70e9ad)), closes [#1577](https://github.com/angular-translate/angular-translate/issues/1577)
|
|
||||||
* **style:** fix code style issues in ~-attr directive ([1848bc8](https://github.com/angular-translate/angular-translate/commit/1848bc8))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.12.0"></a>
|
|
||||||
# [2.12.0](https://github.com/angular-translate/angular-translate/compare/2.11.1...v2.12.0) (2016-09-05)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **service:** fix infinite loop when fallback language async loading fails ([233f30c](https://github.com/angular-translate/angular-translate/commit/233f30c))
|
|
||||||
* **service:** treat date param as-is (no sanitize/escape) ([ab1ecce](https://github.com/angular-translate/angular-translate/commit/ab1ecce)), closes [#1560](https://github.com/angular-translate/angular-translate/issues/1560)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **directive:** introduce standalone translate-attr directive ([bcb0f2c](https://github.com/angular-translate/angular-translate/commit/bcb0f2c))
|
|
||||||
* **partial loader:** add error response to errorHandler ([e3aba1c](https://github.com/angular-translate/angular-translate/commit/e3aba1c))
|
|
||||||
* **service:** introduce new sanitize strategies: sce/sceParameters ([1624df5](https://github.com/angular-translate/angular-translate/commit/1624df5))
|
|
||||||
* **service:** provide for sanitize/escape strategy 3rd argument context ([8504c60](https://github.com/angular-translate/angular-translate/commit/8504c60))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.11.1"></a>
|
|
||||||
## [2.11.1](https://github.com/angular-translate/angular-translate/compare/2.11.0...v2.11.1) (2016-07-17)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **dependencies:** Update messageformat to ~0.3.1 ([04e11c9](https://github.com/angular-translate/angular-translate/commit/04e11c9))
|
|
||||||
* **grunt:** add work-around for uglify preserveComments as expected ([32cdedb](https://github.com/angular-translate/angular-translate/commit/32cdedb)), closes [#1461](https://github.com/angular-translate/angular-translate/issues/1461)
|
|
||||||
* **service:** allow instant function to also take care of post process configuration ([b7d7907](https://github.com/angular-translate/angular-translate/commit/b7d7907))
|
|
||||||
* **service:** avoid sanitizing of functions ([492d8e5](https://github.com/angular-translate/angular-translate/commit/492d8e5)), closes [#1529](https://github.com/angular-translate/angular-translate/issues/1529)
|
|
||||||
* **service:** Correct descriptive ngdocs to match parameters on the service calls ([91711f7](https://github.com/angular-translate/angular-translate/commit/91711f7))
|
|
||||||
* **service:** fix interpolation issue with non-string as input ([fa4a80e](https://github.com/angular-translate/angular-translate/commit/fa4a80e)), closes [#1511](https://github.com/angular-translate/angular-translate/issues/1511)
|
|
||||||
* **service:** fix lost of data in async loader / error in runtime ([5ee0c3e](https://github.com/angular-translate/angular-translate/commit/5ee0c3e))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **directive:** introduce a global keepContent setting ([2015f79](https://github.com/angular-translate/angular-translate/commit/2015f79))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.11.0"></a>
|
|
||||||
# [2.11.0](https://github.com/angular-translate/angular-translate/compare/2.10.0...v2.11.0) (2016-03-20)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **directive:** reduced number of watchers by applying translateLanguage watcher only when direc ([961fc92](https://github.com/angular-translate/angular-translate/commit/961fc92))
|
|
||||||
* **service:** add missing hasOwnProperty check ([823afc0](https://github.com/angular-translate/angular-translate/commit/823afc0))
|
|
||||||
* **service:** avoid try to load languages which are explicitly not wanted ([bde935e](https://github.com/angular-translate/angular-translate/commit/bde935e)), closes [#1390](https://github.com/angular-translate/angular-translate/issues/1390)
|
|
||||||
* **service:** fix edge-case with .use() and .preferredLanguage() ([02688f2](https://github.com/angular-translate/angular-translate/commit/02688f2))
|
|
||||||
* **service:** translations for `forceLanguage` will be loaded on demand ([14bc956](https://github.com/angular-translate/angular-translate/commit/14bc956)), closes [#1389](https://github.com/angular-translate/angular-translate/issues/1389)
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **depenceny:** Update messageformat.js to current 0.3.0 release ([fb48f78](https://github.com/angular-translate/angular-translate/commit/fb48f78))
|
|
||||||
* **directive:** introduce attr translate-keep-content ([b2cf8a3](https://github.com/angular-translate/angular-translate/commit/b2cf8a3))
|
|
||||||
* **service:** add `$translate.resolveClientLocale()` (also at provider) ([d0469ac](https://github.com/angular-translate/angular-translate/commit/d0469ac))
|
|
||||||
* **service:** add support for uniformLanguageTag('iso639-1') ([1e037ec](https://github.com/angular-translate/angular-translate/commit/1e037ec)), closes [#1181](https://github.com/angular-translate/angular-translate/issues/1181)
|
|
||||||
* **service:** improve messageformat.js output caching ([cb31608](https://github.com/angular-translate/angular-translate/commit/cb31608))
|
|
||||||
* **service:** introduce getter returning available languages ([3988af0](https://github.com/angular-translate/angular-translate/commit/3988af0)), closes [#1304](https://github.com/angular-translate/angular-translate/issues/1304)
|
|
||||||
* **service:** introduce post processing for translations ([f0c4874](https://github.com/angular-translate/angular-translate/commit/f0c4874))
|
|
||||||
* **service:** support for default translation in missingTranslationHandler ([8c5044c](https://github.com/angular-translate/angular-translate/commit/8c5044c))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.10.0"></a>
|
|
||||||
# [2.10.0](https://github.com/angular-translate/angular-translate/compare/2.9.2...v2.10.0) (2016-02-28)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **service:** make the fallback $uses / $translate.use work in a correct manner ([7e71a5a](https://github.com/angular-translate/angular-translate/commit/7e71a5a))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.9.2"></a>
|
|
||||||
## [2.9.2](https://github.com/angular-translate/angular-translate/compare/2.9.1...v2.9.2) (2016-02-21)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **package:** redefine dependency version range (AJS 1.5) ([94eb844](https://github.com/angular-translate/angular-translate/commit/94eb844)), closes [#1394](https://github.com/angular-translate/angular-translate/issues/1394) [#1395](https://github.com/angular-translate/angular-translate/issues/1395) [#1397](https://github.com/angular-translate/angular-translate/issues/1397)
|
|
||||||
* **package:** redefine dependency version range (AJS 1.5) (fixup) ([20da73d](https://github.com/angular-translate/angular-translate/commit/20da73d)), closes [#1394](https://github.com/angular-translate/angular-translate/issues/1394) [#1395](https://github.com/angular-translate/angular-translate/issues/1395) [#1397](https://github.com/angular-translate/angular-translate/issues/1397)
|
|
||||||
* **service:** avoid call stack size error, print proper message ([73ea6e3](https://github.com/angular-translate/angular-translate/commit/73ea6e3))
|
|
||||||
* **service:** ensure fallback language can be selected as `$uses` ([40ad523](https://github.com/angular-translate/angular-translate/commit/40ad523))
|
|
||||||
* **service:** remove invalid argument for promise.finally ([2d72908](https://github.com/angular-translate/angular-translate/commit/2d72908))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.9.1"></a>
|
|
||||||
## [2.9.1](https://github.com/angular-translate/angular-translate/compare/2.9.0...v2.9.1) (2016-02-13)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **package:** redefine dependency version range (AJS 1.5) ([9ccce6b](https://github.com/angular-translate/angular-translate/commit/9ccce6b)), closes [#1394](https://github.com/angular-translate/angular-translate/issues/1394) [#1395](https://github.com/angular-translate/angular-translate/issues/1395) [#1397](https://github.com/angular-translate/angular-translate/issues/1397)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.9.0"></a>
|
|
||||||
# [2.9.0](https://github.com/angular-translate/angular-translate/compare/2.8.1...v2.9.0) (2016-01-24)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **$translate:** apply notFoundIndicators only when all configured language checked in $translate ([25b13c4](https://github.com/angular-translate/angular-translate/commit/25b13c4)), closes [#1314](https://github.com/angular-translate/angular-translate/issues/1314)
|
|
||||||
* **directive:** add additional watcher validating cloak ([e7536b5](https://github.com/angular-translate/angular-translate/commit/e7536b5)), closes [#1287](https://github.com/angular-translate/angular-translate/issues/1287)
|
|
||||||
* **directive:** enforce update on default text change only ([ea94acd](https://github.com/angular-translate/angular-translate/commit/ea94acd))
|
|
||||||
* **docs:** correct all occurrences of language names PR #1243 ([5f89d55](https://github.com/angular-translate/angular-translate/commit/5f89d55))
|
|
||||||
* **docs:** fix broken link ([e641fe4](https://github.com/angular-translate/angular-translate/commit/e641fe4))
|
|
||||||
* **docs:** Fix some typos in spanish ([830a84b](https://github.com/angular-translate/angular-translate/commit/830a84b))
|
|
||||||
* **docs:** refresh outdated link ([392cab0](https://github.com/angular-translate/angular-translate/commit/392cab0))
|
|
||||||
* **package:** add missing run-scriptlet "clean-test-scopes" ([c22c727](https://github.com/angular-translate/angular-translate/commit/c22c727))
|
|
||||||
* **service:** partial loader service refetches list of parts ([069eafd](https://github.com/angular-translate/angular-translate/commit/069eafd)), closes [#1326](https://github.com/angular-translate/angular-translate/issues/1326)
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **build:** update test scope "AJS 1.5" using rc0 ([26cdc05](https://github.com/angular-translate/angular-translate/commit/26cdc05))
|
|
||||||
* **dependencies:** add `angular` as the required dependency ([475a9b6](https://github.com/angular-translate/angular-translate/commit/475a9b6))
|
|
||||||
* **service:** expose `$translate.negotiateLocale` being public ([9247000](https://github.com/angular-translate/angular-translate/commit/9247000))
|
|
||||||
* **service:** force language used for translating ([e591462](https://github.com/angular-translate/angular-translate/commit/e591462))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.8.1"></a>
|
|
||||||
## [2.8.1](https://github.com/angular-translate/angular-translate/compare/2.8.0...v2.8.1) (2015-10-01)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **service:** Fix `$translate.isReady()` won't return true if ready ([b40a344](https://github.com/angular-translate/angular-translate/commit/b40a344)), closes [#1239](https://github.com/angular-translate/angular-translate/issues/1239)
|
|
||||||
* **service:** should not abort fallback languages (feature #1070) ([cc410b1](https://github.com/angular-translate/angular-translate/commit/cc410b1)), closes [#1070](https://github.com/angular-translate/angular-translate/issues/1070)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.8.0"></a>
|
|
||||||
# [2.8.0](https://github.com/angular-translate/angular-translate/compare/2.7.2...2.8.0) (2015-09-18)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **build:** ensure MessageFormat will be added correctly when using UMD ([f5e039c](https://github.com/angular-translate/angular-translate/commit/f5e039c))
|
|
||||||
* **directive:** Fix behavior of translate-cloak timing ([a6adf47](https://github.com/angular-translate/angular-translate/commit/a6adf47)), closes [#929](https://github.com/angular-translate/angular-translate/issues/929) [#1175](https://github.com/angular-translate/angular-translate/issues/1175)
|
|
||||||
* **directive:** Fix special IE11 issue #925 ([c4b16d3](https://github.com/angular-translate/angular-translate/commit/c4b16d3)), closes [#925](https://github.com/angular-translate/angular-translate/issues/925)
|
|
||||||
* **docs:** avoid using absolute links in lang chooser #1136 ([2cdc902](https://github.com/angular-translate/angular-translate/commit/2cdc902))
|
|
||||||
* **docs:** Fix more typos in CONTRIBUTING.md, add some infos about tests ([e88b990](https://github.com/angular-translate/angular-translate/commit/e88b990))
|
|
||||||
* **docs:** Fix typo in CONTRIBUTING.md ([1c2ac47](https://github.com/angular-translate/angular-translate/commit/1c2ac47))
|
|
||||||
* **docs:** Fix typo in zh-cn docs ([2a16eb6](https://github.com/angular-translate/angular-translate/commit/2a16eb6))
|
|
||||||
* **service:** abort the last loader if not finished #1070 ([dd4a8b4](https://github.com/angular-translate/angular-translate/commit/dd4a8b4))
|
|
||||||
* **service:** update storage before triggering $translateChangeSuccess ([77dd5a2](https://github.com/angular-translate/angular-translate/commit/77dd5a2))
|
|
||||||
* **service provider:** change/fix return of preferredLanguage() ([6014a81](https://github.com/angular-translate/angular-translate/commit/6014a81))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **directive:** translate-namespace directive ([45523bb](https://github.com/angular-translate/angular-translate/commit/45523bb))
|
|
||||||
* **loaders:** addition to e7516dc #1080 (disable legacy $http cbs) ([233a012](https://github.com/angular-translate/angular-translate/commit/233a012))
|
|
||||||
* **loaders:** remove use of legacy methods on $http promises #1080 ([e7516dc](https://github.com/angular-translate/angular-translate/commit/e7516dc))
|
|
||||||
* **meta:** enrich copyright header with a leagl person ([21da61c](https://github.com/angular-translate/angular-translate/commit/21da61c))
|
|
||||||
* **sanitize:** Allow sanitize strategy defined as a service ([8a6cc07](https://github.com/angular-translate/angular-translate/commit/8a6cc07))
|
|
||||||
* **service:** add option to customize the nested delimiter ([78161f8](https://github.com/angular-translate/angular-translate/commit/78161f8))
|
|
||||||
* **service:** introduce `isReady()` and `onReady()` with event ([9a4bd0d](https://github.com/angular-translate/angular-translate/commit/9a4bd0d))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.7.2"></a>
|
|
||||||
## [2.7.2](https://github.com/angular-translate/angular-translate/compare/2.7.1...2.7.2) (2015-06-01)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **directive:** ensure value of `translate` will be translated always ([454d702](https://github.com/angular-translate/angular-translate/commit/454d702))
|
|
||||||
* **sanitization:** fix/workaround issue when jQuery is not available ([ef1b10a](https://github.com/angular-translate/angular-translate/commit/ef1b10a))
|
|
||||||
* **service:** fix silence on error, add missing catch on `refresh()` ([f3ec956](https://github.com/angular-translate/angular-translate/commit/f3ec956))
|
|
||||||
* **service:** fix silence on error, add missing catch on `refresh()` ([5a85a64](https://github.com/angular-translate/angular-translate/commit/5a85a64))
|
|
||||||
* **service:** make provider's storageKey chainable ([de8c253](https://github.com/angular-translate/angular-translate/commit/de8c253))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.7.1"></a>
|
|
||||||
## [2.7.1](https://github.com/angular-translate/angular-translate/compare/2.7.0...2.7.1) (2015-06-01)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **docs:** fix typo in $translateChangeSuccess ([89e2569](https://github.com/angular-translate/angular-translate/commit/89e2569))
|
|
||||||
* **service:** handle error "this.replace is not a function" ([8616dca](https://github.com/angular-translate/angular-translate/commit/8616dca))
|
|
||||||
* **service:** integrate translationCache into service distribution file ([2fcbc60](https://github.com/angular-translate/angular-translate/commit/2fcbc60))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **$translateProvider:** add a new option to force async reload ([bdee77f](https://github.com/angular-translate/angular-translate/commit/bdee77f))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.7.0"></a>
|
|
||||||
# [2.7.0](https://github.com/angular-translate/angular-translate/compare/2.6.1...2.7.0) (2015-05-02)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **directive:** fix issue with `data-` prefixed attributes #954 ([ee253bc](https://github.com/angular-translate/angular-translate/commit/ee253bc)), closes [#954](https://github.com/angular-translate/angular-translate/issues/954)
|
|
||||||
* **directive:** fix translate-value-* weren't be available on init ([98e8279](https://github.com/angular-translate/angular-translate/commit/98e8279))
|
|
||||||
* **directive:** fix wrong initial translation causing overloading ([657ed8a](https://github.com/angular-translate/angular-translate/commit/657ed8a))
|
|
||||||
* **directive:** handle interpolation of undefined keys correctly in updateTranslations, fixes is ([3f7cf4c](https://github.com/angular-translate/angular-translate/commit/3f7cf4c)), closes [#971](https://github.com/angular-translate/angular-translate/issues/971)
|
|
||||||
* **directive:** Make interpolate message format work smoothly also on message format > 0.1.7 - f ([2533f2d](https://github.com/angular-translate/angular-translate/commit/2533f2d)), closes [#789](https://github.com/angular-translate/angular-translate/issues/789)
|
|
||||||
* **directive:** make translate-values interpolate correctly with newer MessageFormat.js ([887dc1b](https://github.com/angular-translate/angular-translate/commit/887dc1b))
|
|
||||||
* **docs:** bug in "Flash of untranslated content" section ([af5d746](https://github.com/angular-translate/angular-translate/commit/af5d746))
|
|
||||||
* **docs:** fix invalid link in directive ([985cfd5](https://github.com/angular-translate/angular-translate/commit/985cfd5))
|
|
||||||
* **docs:** typo in module type ([f0527b1](https://github.com/angular-translate/angular-translate/commit/f0527b1))
|
|
||||||
* **feat:** export module name improving usage module loaders #944 ([cb33f63](https://github.com/angular-translate/angular-translate/commit/cb33f63))
|
|
||||||
* **messageformat:** add duck type check for numbers #789 ([bbc1cbe](https://github.com/angular-translate/angular-translate/commit/bbc1cbe))
|
|
||||||
* **refresh:** it has to clear all tables if no language key is specified ([3cce795](https://github.com/angular-translate/angular-translate/commit/3cce795))
|
|
||||||
* **service:** always remove stored ref for lang promises ([dbd5be9](https://github.com/angular-translate/angular-translate/commit/dbd5be9)), closes [#824](https://github.com/angular-translate/angular-translate/issues/824) [#969](https://github.com/angular-translate/angular-translate/issues/969)
|
|
||||||
* **service:** do not try to load a predefined fallback language ([3be14df](https://github.com/angular-translate/angular-translate/commit/3be14df))
|
|
||||||
* **service:** fix an issue resolving after missing translations ([a13899f](https://github.com/angular-translate/angular-translate/commit/a13899f))
|
|
||||||
* **service:** fix possible npe ([1aaab98](https://github.com/angular-translate/angular-translate/commit/1aaab98))
|
|
||||||
* **test/refresh:** fix current table refreshing test ([a298ed8](https://github.com/angular-translate/angular-translate/commit/a298ed8))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **$translatePartialLoader:** accept function in urlTemplate ([401204a](https://github.com/angular-translate/angular-translate/commit/401204a))
|
|
||||||
* **build:** introduce module definition ([00b73ff](https://github.com/angular-translate/angular-translate/commit/00b73ff))
|
|
||||||
* **filter:** add new option `$translate.statefulFilter()` ([dec4bf3](https://github.com/angular-translate/angular-translate/commit/dec4bf3))
|
|
||||||
* **missingTranslationHandlerFactory:** pass interpolationParams to missingTranslationHandlerFactory ([a361fd0](https://github.com/angular-translate/angular-translate/commit/a361fd0))
|
|
||||||
* **sanitization:** refactored, fixed and extended sanitization #993 ([12dbc57](https://github.com/angular-translate/angular-translate/commit/12dbc57)), closes [#993](https://github.com/angular-translate/angular-translate/issues/993)
|
|
||||||
* **service:** add uniformLanguageTagResolver ([b534e1a](https://github.com/angular-translate/angular-translate/commit/b534e1a))
|
|
||||||
|
|
||||||
### Performance Improvements
|
|
||||||
|
|
||||||
* **directive:** watch parameters only if exist ([f0e2585](https://github.com/angular-translate/angular-translate/commit/f0e2585))
|
|
||||||
|
|
||||||
|
|
||||||
### BREAKING CHANGES
|
|
||||||
|
|
||||||
* You will get a warning message when using the default setting (not escaping the content).
|
|
||||||
You can fix (and remove) this warning by explicit set a sanitization strategy
|
|
||||||
within your config phase configuring $translateProvider. Even configuring the `null` mode will let the
|
|
||||||
warning disapper. You are highly encouraged specifing any mode except `null` because of security concerns.
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.6.1"></a>
|
|
||||||
## [2.6.1](https://github.com/angular-translate/angular-translate/compare/2.6.0...2.6.1) (2015-03-01)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **bower spec:** fix bower main property #922 ([3a1ad10](https://github.com/angular-translate/angular-translate/commit/3a1ad10)), closes [#922](https://github.com/angular-translate/angular-translate/issues/922)
|
|
||||||
* **custom interpolator:** improve handling of interpolator ids which don't exist ([373b46f](https://github.com/angular-translate/angular-translate/commit/373b46f))
|
|
||||||
* **static-files-loader:** fix multiple files definition (docu update) #923, pr #936 ([e637c01](https://github.com/angular-translate/angular-translate/commit/e637c01)), closes [#923](https://github.com/angular-translate/angular-translate/issues/923) [#936](https://github.com/angular-translate/angular-translate/issues/936)
|
|
||||||
* **static-files-loader:** fix multiple files definition #923 ([1b6256a](https://github.com/angular-translate/angular-translate/commit/1b6256a)), closes [#923](https://github.com/angular-translate/angular-translate/issues/923)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.6.0"></a>
|
|
||||||
# [2.6.0](https://github.com/angular-translate/angular-translate/compare/2.5.2...2.6.0) (2015-02-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **directive:** ensure internal watcher will be removed ([e69f4a1](https://github.com/angular-translate/angular-translate/commit/e69f4a1))
|
|
||||||
* **directive:** fix minor memory leak ([5e4533a](https://github.com/angular-translate/angular-translate/commit/5e4533a))
|
|
||||||
* **directive:** fix missing update using dynamic translationIds ([faebe19](https://github.com/angular-translate/angular-translate/commit/faebe19)), closes [#854](https://github.com/angular-translate/angular-translate/issues/854)
|
|
||||||
* **directive:** newlines before/after translation ids should be ignored ([8dcf3e2](https://github.com/angular-translate/angular-translate/commit/8dcf3e2)), closes [#909](https://github.com/angular-translate/angular-translate/issues/909)
|
|
||||||
* **directive, service:** return value of translate-default also in case fallback languages are used - rel ([fcd6b3e](https://github.com/angular-translate/angular-translate/commit/fcd6b3e))
|
|
||||||
* **filter:** apply notFoundIndicators also for instant translations correctly ([5a9f436](https://github.com/angular-translate/angular-translate/commit/5a9f436)), closes [#866](https://github.com/angular-translate/angular-translate/issues/866)
|
|
||||||
* **service:** fallback languages follow shortcuts (fixes #758) ([cce897a](https://github.com/angular-translate/angular-translate/commit/cce897a)), closes [#758](https://github.com/angular-translate/angular-translate/issues/758)
|
|
||||||
* **service:** fix an issue with default interpolator and expressions ([75b7381](https://github.com/angular-translate/angular-translate/commit/75b7381))
|
|
||||||
* **service:** use $window/$windowProvider instead of window ([bfa7b7b](https://github.com/angular-translate/angular-translate/commit/bfa7b7b))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **$translatePartialLoader:** adds optional priority param to the addPart function ([570617c](https://github.com/angular-translate/angular-translate/commit/570617c))
|
|
||||||
* **directive:** add $translateProvider.directityPriority ([b0b7716](https://github.com/angular-translate/angular-translate/commit/b0b7716))
|
|
||||||
* **loader:** support for multiple static translation files ([c462ee6](https://github.com/angular-translate/angular-translate/commit/c462ee6))
|
|
||||||
* **service:** extend loader api: add isPartLoaded and getRegisteredParts to $translatePartialL ([54f8ab3](https://github.com/angular-translate/angular-translate/commit/54f8ab3))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.5.2"></a>
|
|
||||||
## [2.5.2](https://github.com/angular-translate/angular-translate/compare/2.5.0...2.5.2) (2014-12-10)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **directive:** missing watch for expression within elements text nodes ([31c0356](https://github.com/angular-translate/angular-translate/commit/31c0356)), closes [#701](https://github.com/angular-translate/angular-translate/issues/701)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.5.0"></a>
|
|
||||||
# [2.5.0](https://github.com/angular-translate/angular-translate/compare/2.4.2...2.5.0) (2014-12-07)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **directive:** ensure directive's text will be parsed at least once ([49cfef0](https://github.com/angular-translate/angular-translate/commit/49cfef0))
|
|
||||||
* **loader:** under circum understances translation table got lost ([df37381](https://github.com/angular-translate/angular-translate/commit/df37381))
|
|
||||||
* **messageformat-interpolation:** fix support for messageformat 0.2.* ([ac8d5ed](https://github.com/angular-translate/angular-translate/commit/ac8d5ed))
|
|
||||||
* **service:** apply fix for empty strings in `navigator.language` ([5b4edd9](https://github.com/angular-translate/angular-translate/commit/5b4edd9))
|
|
||||||
* **service:** fix npe when resolving fallback language for `instant` ([7c09d89](https://github.com/angular-translate/angular-translate/commit/7c09d89))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **$translateUrlLoader:** allow to use custom query parameter name for url loader ([e360bf8](https://github.com/angular-translate/angular-translate/commit/e360bf8))
|
|
||||||
* **module:** use same fallback for module.run when no storage key is set ([247253d](https://github.com/angular-translate/angular-translate/commit/247253d)), closes [#739](https://github.com/angular-translate/angular-translate/issues/739)
|
|
||||||
* **storage:** rename set() into put() ([ef6a613](https://github.com/angular-translate/angular-translate/commit/ef6a613))
|
|
||||||
|
|
||||||
|
|
||||||
### BREAKING CHANGES
|
|
||||||
|
|
||||||
* This marks storage.set() as deprecated. In the
|
|
||||||
next major release v3, the old method `set()` will be dropped in favor
|
|
||||||
of `put()`.
|
|
||||||
Relates #772
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.4.2"></a>
|
|
||||||
## [2.4.2](https://github.com/angular-translate/angular-translate/compare/2.4.1...2.4.2) (2014-10-21)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **partialloader:** fix possible circular dependency ([25f252c](https://github.com/angular-translate/angular-translate/commit/25f252c)), closes [#766](https://github.com/angular-translate/angular-translate/issues/766)
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **directive:** translate attributes (optimize process flow) ([508fd32](https://github.com/angular-translate/angular-translate/commit/508fd32))
|
|
||||||
* **directive:** translate attributes using directive ([1d06d2a](https://github.com/angular-translate/angular-translate/commit/1d06d2a)), closes [#568](https://github.com/angular-translate/angular-translate/issues/568)
|
|
||||||
* **directive:** translate-cloak supports optional value for cloaking ([f7ccb7f](https://github.com/angular-translate/angular-translate/commit/f7ccb7f))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.4.1"></a>
|
|
||||||
## [2.4.1](https://github.com/angular-translate/angular-translate/compare/2.4.0...2.4.1) (2014-10-03)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **service:** add missing final event on new (async) translations ([22cc8b4](https://github.com/angular-translate/angular-translate/commit/22cc8b4))
|
|
||||||
* **service:** constructor `useUrlLoader()` missed optional options ([22f5c4b](https://github.com/angular-translate/angular-translate/commit/22f5c4b))
|
|
||||||
* **service, loaders:** the loader options ($http) have been merged wrong ([0c35a95](https://github.com/angular-translate/angular-translate/commit/0c35a95)), closes [#754](https://github.com/angular-translate/angular-translate/issues/754) [#547](https://github.com/angular-translate/angular-translate/issues/547)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.4.0"></a>
|
|
||||||
# [2.4.0](https://github.com/angular-translate/angular-translate/compare/2.3.0...2.4.0) (2014-09-22)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **filter:** interpolated params w/ scope aren't possible starting AJS1.3 ([9465318](https://github.com/angular-translate/angular-translate/commit/9465318))
|
|
||||||
* **filter:** mark filter being stateful required since Angular 1.3 rc2 ([bffbf04](https://github.com/angular-translate/angular-translate/commit/bffbf04))
|
|
||||||
* **service:** `$nextLang` should be not unset parallel loadings ([d1745e4](https://github.com/angular-translate/angular-translate/commit/d1745e4)), closes [#647](https://github.com/angular-translate/angular-translate/issues/647)
|
|
||||||
* **service:** avoid possible doubled requested on refresh() ([98d429d](https://github.com/angular-translate/angular-translate/commit/98d429d))
|
|
||||||
* **service:** avoid possible npe in internal getTranslationTable() ([9aaa9a0](https://github.com/angular-translate/angular-translate/commit/9aaa9a0))
|
|
||||||
* **service:** correctly iterate in fallback languages (fixes #690) ([ac2f35c](https://github.com/angular-translate/angular-translate/commit/ac2f35c)), closes [#690](https://github.com/angular-translate/angular-translate/issues/690)
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **loader:** apply support for loaderOptions.$http ([8613bef](https://github.com/angular-translate/angular-translate/commit/8613bef))
|
|
||||||
* **loaders:** introduce loader cache ([b685601](https://github.com/angular-translate/angular-translate/commit/b685601)), closes [#529](https://github.com/angular-translate/angular-translate/issues/529)
|
|
||||||
* **service:** enrich events with the currently handled language key ([73b289d](https://github.com/angular-translate/angular-translate/commit/73b289d))
|
|
||||||
* **service:** interpolate translationId in case of rejected translation ([3efaac5](https://github.com/angular-translate/angular-translate/commit/3efaac5)), closes [#730](https://github.com/angular-translate/angular-translate/issues/730)
|
|
||||||
* **service:** introduce `versionInfo` function ([e37d89c](https://github.com/angular-translate/angular-translate/commit/e37d89c))
|
|
||||||
* **service:** prefer detecting language by `navigator.languages` #722 ([2204f4f](https://github.com/angular-translate/angular-translate/commit/2204f4f))
|
|
||||||
|
|
||||||
|
|
||||||
### BREAKING CHANGES
|
|
||||||
|
|
||||||
* Since filters are stateless and have no access to its scope anymore (see https://github.com/angular/angular.js/commit/8863b9d04c722b278fa93c5d66ad1e578ad6eb1f), a context must be given explicitly. This removes the feature of an interpolation based on the scope (context), even without the $rootScope.
|
|
||||||
However, the feature will still work in AJS <=1.2, so we won't remove it completely yet. Handle the feature as slightly deprecated.
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.3.0"></a>
|
|
||||||
# [2.3.0](https://github.com/angular-translate/angular-translate/compare/2.2.0...2.3.0) (2014-09-16)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **$translate:** return $missingTranslationHandler result when no translation was found ([7625951](https://github.com/angular-translate/angular-translate/commit/7625951))
|
|
||||||
* **bower.json:** Avoid 'invalid-meta angular-bootstrap-affix is missing "ignore" entry in bower.j ([595501a](https://github.com/angular-translate/angular-translate/commit/595501a)), closes [bower/bower#1388](https://github.com/bower/bower/issues/1388)
|
|
||||||
* **demo:** fixes wrong method call in demo ([47fc943](https://github.com/angular-translate/angular-translate/commit/47fc943))
|
|
||||||
* **directive:** change event for listening to `$translateChangeEnd` ([98fe649](https://github.com/angular-translate/angular-translate/commit/98fe649)), closes [#658](https://github.com/angular-translate/angular-translate/issues/658)
|
|
||||||
* **directive:** improve the cloak-directive's performance ([acab18a](https://github.com/angular-translate/angular-translate/commit/acab18a))
|
|
||||||
* **docs:** fix example in directive ngdoc-documentation (fixes #678) ([176b3e9](https://github.com/angular-translate/angular-translate/commit/176b3e9)), closes [#678](https://github.com/angular-translate/angular-translate/issues/678)
|
|
||||||
* **docs:** Fix typo ([6c2ab30](https://github.com/angular-translate/angular-translate/commit/6c2ab30))
|
|
||||||
* **package.json:** remove unnecessary relative paths from package.json ([8e5b87e](https://github.com/angular-translate/angular-translate/commit/8e5b87e))
|
|
||||||
* **service:** add shim for indexOf and trim #638 ([b951fd5](https://github.com/angular-translate/angular-translate/commit/b951fd5))
|
|
||||||
* **service:** addition of preferred language to fallback language stack is now preventing dupl ([b2bb166](https://github.com/angular-translate/angular-translate/commit/b2bb166))
|
|
||||||
* **service:** load fallback languages also for instant and filter ([ed6023a](https://github.com/angular-translate/angular-translate/commit/ed6023a))
|
|
||||||
* **service:** use hasOwnProperty of prototype #638 ([d8a5060](https://github.com/angular-translate/angular-translate/commit/d8a5060))
|
|
||||||
* **storage:** fix 'DOM Exception 18' at feature detection ([75504cb](https://github.com/angular-translate/angular-translate/commit/75504cb)), closes [#629](https://github.com/angular-translate/angular-translate/issues/629)
|
|
||||||
* **storage:** fixup 75504cbe ([53a8bad](https://github.com/angular-translate/angular-translate/commit/53a8bad))
|
|
||||||
* **translateService:** fixup/rewrite for b48f6bb (specs) ([45ac14d](https://github.com/angular-translate/angular-translate/commit/45ac14d))
|
|
||||||
* **translateService:** prevent multiple XHR calls ([b48f6bb](https://github.com/angular-translate/angular-translate/commit/b48f6bb))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **directive:** add possibility to mix translation interpolation with other text in element body ([be62131](https://github.com/angular-translate/angular-translate/commit/be62131)), closes [#461](https://github.com/angular-translate/angular-translate/issues/461)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.2.0"></a>
|
|
||||||
# [2.2.0](https://github.com/angular-translate/angular-translate/compare/2.1.0...2.2.0) (2014-06-03)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **$translate:** checks modification ([b91e4de](https://github.com/angular-translate/angular-translate/commit/b91e4de))
|
|
||||||
* **$translate:** if translation exists, use the translated string even if it's empty ([4ba736f](https://github.com/angular-translate/angular-translate/commit/4ba736f))
|
|
||||||
* **$translate:** if translation exists, use the translated string even if it's empty ([eeb8c2a](https://github.com/angular-translate/angular-translate/commit/eeb8c2a))
|
|
||||||
* **$translate:** use case-insensitive check for language key aliases ([09a8bf1](https://github.com/angular-translate/angular-translate/commit/09a8bf1)), closes [#431](https://github.com/angular-translate/angular-translate/issues/431)
|
|
||||||
* **$translate:** use case-insensitive check for language key aliases ([26ec308](https://github.com/angular-translate/angular-translate/commit/26ec308)), closes [#431](https://github.com/angular-translate/angular-translate/issues/431)
|
|
||||||
* **$translateProvider:** determinePreferredLanguage was not chainable ([7c29f2f](https://github.com/angular-translate/angular-translate/commit/7c29f2f)), closes [#487](https://github.com/angular-translate/angular-translate/issues/487)
|
|
||||||
* **$translateProvider:** fix comparison in one case of negotiateLocale() ([c2b94ca](https://github.com/angular-translate/angular-translate/commit/c2b94ca))
|
|
||||||
* **$translateProvider:** fix comparison in one case of negotiateLocale() ([fe04c72](https://github.com/angular-translate/angular-translate/commit/fe04c72))
|
|
||||||
* **demo:** correct demo of `translate-values` ([efa74fa](https://github.com/angular-translate/angular-translate/commit/efa74fa))
|
|
||||||
* **demo:** correct demo of `translate-values` ([7de2ae2](https://github.com/angular-translate/angular-translate/commit/7de2ae2))
|
|
||||||
* **demo:** use `.instant()` ([6bea192](https://github.com/angular-translate/angular-translate/commit/6bea192))
|
|
||||||
* **directive:** Make translate-value-* work inside ng-if and ng-repeat ([e07eea7](https://github.com/angular-translate/angular-translate/commit/e07eea7)), closes [#433](https://github.com/angular-translate/angular-translate/issues/433)
|
|
||||||
* **directive:** Make translate-value-* work inside ng-if and ng-repeat ([f22624b](https://github.com/angular-translate/angular-translate/commit/f22624b)), closes [#433](https://github.com/angular-translate/angular-translate/issues/433)
|
|
||||||
* **docs:** removes explicit protocol declaration for assets ([eaa9bf7](https://github.com/angular-translate/angular-translate/commit/eaa9bf7)), closes [#513](https://github.com/angular-translate/angular-translate/issues/513)
|
|
||||||
* **gruntfile:** fix image link ([65fc8be](https://github.com/angular-translate/angular-translate/commit/65fc8be))
|
|
||||||
* **package.json:** fix repository url ([40af7ce](https://github.com/angular-translate/angular-translate/commit/40af7ce))
|
|
||||||
* **package.json:** fix repository url ([a410c9a](https://github.com/angular-translate/angular-translate/commit/a410c9a))
|
|
||||||
* **partialLoader:** fixes deprecated usage of arguments.callee ([1ac3a0a](https://github.com/angular-translate/angular-translate/commit/1ac3a0a))
|
|
||||||
* **service:** docs annotation ([8ef0415](https://github.com/angular-translate/angular-translate/commit/8ef0415))
|
|
||||||
* **service:** docs annotation ([839c4e8](https://github.com/angular-translate/angular-translate/commit/839c4e8))
|
|
||||||
* **service:** use the aliased language key if available ([675e9a2](https://github.com/angular-translate/angular-translate/commit/675e9a2)), closes [#530](https://github.com/angular-translate/angular-translate/issues/530)
|
|
||||||
* **storageLocal:** fixes QUOTAEXCEEDEDERROR (safari private browsing) ([59aa2a0](https://github.com/angular-translate/angular-translate/commit/59aa2a0))
|
|
||||||
* fix npe on empty strings (trim()) ([c69de7b](https://github.com/angular-translate/angular-translate/commit/c69de7b))
|
|
||||||
* **translateInterpolator:** make it work with 1.3-beta ([97e2241](https://github.com/angular-translate/angular-translate/commit/97e2241))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **directive:** add option to define a default translation text ([a802665](https://github.com/angular-translate/angular-translate/commit/a802665))
|
|
||||||
* **directive:** add option to define a default translation text ([fc57d26](https://github.com/angular-translate/angular-translate/commit/fc57d26))
|
|
||||||
* **directive:** Support for camel casing interpolation variables. ([b345041](https://github.com/angular-translate/angular-translate/commit/b345041))
|
|
||||||
* **directive:** Support for camel casing interpolation variables. ([4791e25](https://github.com/angular-translate/angular-translate/commit/4791e25))
|
|
||||||
* **messageformat-support:** enhancing for sanitization like default ([ad01686](https://github.com/angular-translate/angular-translate/commit/ad01686))
|
|
||||||
* **missingFallbackDefaultText:** enables a feature to return a default text for displaying in case of missing tra ([f24b15e](https://github.com/angular-translate/angular-translate/commit/f24b15e))
|
|
||||||
* **service:** add possibility to translate a set of translation ids ([612dc27](https://github.com/angular-translate/angular-translate/commit/612dc27))
|
|
||||||
* **service:** add possibility to translate a set of translation ids ([57bd07c](https://github.com/angular-translate/angular-translate/commit/57bd07c))
|
|
||||||
* **service:** allow using wildcards in language aliases ([6f0ae3b](https://github.com/angular-translate/angular-translate/commit/6f0ae3b)), closes [#426](https://github.com/angular-translate/angular-translate/issues/426)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.0.1"></a>
|
|
||||||
## [2.0.1](https://github.com/angular-translate/angular-translate/compare/2.0.0...2.0.1) (2014-02-25)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **$translate:** Ensuring that languages will be set based on the order they are requested, not t ([c909cd2](https://github.com/angular-translate/angular-translate/commit/c909cd2))
|
|
||||||
* **$translate:** Ensuring that languages will be set based on the order they are requested, not t ([ebd62af](https://github.com/angular-translate/angular-translate/commit/ebd62af))
|
|
||||||
* **$translate:** Ensuring that languages will be set based on the order they are requested, not t ([32e1851](https://github.com/angular-translate/angular-translate/commit/32e1851))
|
|
||||||
* **instant:** $translate.instant(id) does not return correct fallback ([eec1d77](https://github.com/angular-translate/angular-translate/commit/eec1d77))
|
|
||||||
* **instant:** fix possible npe in case of filters with undefineds ([61a9490](https://github.com/angular-translate/angular-translate/commit/61a9490))
|
|
||||||
* **refresh:** fix bug in refresh if using partial loader ([95c43b4](https://github.com/angular-translate/angular-translate/commit/95c43b4))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **instant:** invoke missing handler within `$translate.instant(id)` ([aaf52b5](https://github.com/angular-translate/angular-translate/commit/aaf52b5))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.0.0"></a>
|
|
||||||
# [2.0.0](https://github.com/angular-translate/angular-translate/compare/1.1.1...2.0.0) (2014-02-16)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* ***:** jshint fixes ([1e3f8a6](https://github.com/angular-translate/angular-translate/commit/1e3f8a6))
|
|
||||||
* **$translate:** check for fallbacklanguage ([321803d](https://github.com/angular-translate/angular-translate/commit/321803d))
|
|
||||||
* **$translate:** Trim whitespace off translationId ([4939424](https://github.com/angular-translate/angular-translate/commit/4939424))
|
|
||||||
* **$translatePartialLoader:** fixes docs annotation ([d6ea84b](https://github.com/angular-translate/angular-translate/commit/d6ea84b))
|
|
||||||
* **demo:** fix server routes + add index page ([eb0a2dc](https://github.com/angular-translate/angular-translate/commit/eb0a2dc))
|
|
||||||
* **demo:** links to demo resources updated to new locactions ([fddaa49](https://github.com/angular-translate/angular-translate/commit/fddaa49))
|
|
||||||
* **deps:** add missing resolution ([a98a2f6](https://github.com/angular-translate/angular-translate/commit/a98a2f6))
|
|
||||||
* **docs:** fixes links for languages ([265490f](https://github.com/angular-translate/angular-translate/commit/265490f))
|
|
||||||
* **fallbackLanguage:** Fix fallback languages loading and applying ([4c5c47c](https://github.com/angular-translate/angular-translate/commit/4c5c47c))
|
|
||||||
* **grunt:** includes translate-cloak directive ([84a59d2](https://github.com/angular-translate/angular-translate/commit/84a59d2))
|
|
||||||
* avoid calls with empty translationId (sub issue of #298) ([08f087b](https://github.com/angular-translate/angular-translate/commit/08f087b))
|
|
||||||
* fix npe introduced in 4939424a30 (#281) ([173a9bc](https://github.com/angular-translate/angular-translate/commit/173a9bc)), closes [(#281](https://github.com/(/issues/281) [#298](https://github.com/angular-translate/angular-translate/issues/298)
|
|
||||||
* **guide/ru,uk:** Fix uses->use in multi language ([af59c6a](https://github.com/angular-translate/angular-translate/commit/af59c6a))
|
|
||||||
* **instant:** remove language-preload if there were used within instant ([9a3eda6](https://github.com/angular-translate/angular-translate/commit/9a3eda6))
|
|
||||||
* **loader-static-files.js:** Now allows empty string as prefix and postfix. ([051f431](https://github.com/angular-translate/angular-translate/commit/051f431))
|
|
||||||
* **service:** fallback languages could not load when using `instant()` ([26de486](https://github.com/angular-translate/angular-translate/commit/26de486))
|
|
||||||
* **translateCloak:** makes jshint happy ([2058fd3](https://github.com/angular-translate/angular-translate/commit/2058fd3))
|
|
||||||
* **translateDirective:** fixes bad coding convention ([d5db4ad](https://github.com/angular-translate/angular-translate/commit/d5db4ad))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **$translateProvider:** adds determinePreferredLanguage() ([7cbfabe](https://github.com/angular-translate/angular-translate/commit/7cbfabe))
|
|
||||||
* **$translateProvider:** adds registerAvailableLanguagesKeys for negotiation ([6bef6bd](https://github.com/angular-translate/angular-translate/commit/6bef6bd))
|
|
||||||
* **filter:** filter now use $translate.instant() since promises could not use ([a1b8a17](https://github.com/angular-translate/angular-translate/commit/a1b8a17))
|
|
||||||
* **service:** add $translate.instant() for instant translations ([3a855eb](https://github.com/angular-translate/angular-translate/commit/3a855eb))
|
|
||||||
* add an option for post processing compiling ([d5cd943](https://github.com/angular-translate/angular-translate/commit/d5cd943))
|
|
||||||
* add option to html escape all values ([e042c44](https://github.com/angular-translate/angular-translate/commit/e042c44))
|
|
||||||
* **translateCloak:** adds translate-cloak directive ([c125c56](https://github.com/angular-translate/angular-translate/commit/c125c56))
|
|
||||||
* **translateDirective:** teaches directive custom translate-value-* attr ([5c27467](https://github.com/angular-translate/angular-translate/commit/5c27467)), closes [#188](https://github.com/angular-translate/angular-translate/issues/188)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="1.1.1"></a>
|
|
||||||
## [1.1.1](https://github.com/angular-translate/angular-translate/compare/1.1.0...1.1.1) (2013-11-24)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* fixes encoding ([084f08c](https://github.com/angular-translate/angular-translate/commit/084f08c))
|
|
||||||
* **docs:** fixes typo ([7e1c4e9](https://github.com/angular-translate/angular-translate/commit/7e1c4e9))
|
|
||||||
* **docs:** fixes typo in landing page ([0b999ab](https://github.com/angular-translate/angular-translate/commit/0b999ab))
|
|
||||||
* **grunt:** fixes missing storage-key ([635d290](https://github.com/angular-translate/angular-translate/commit/635d290))
|
|
||||||
* **translateDirective:** fixes occuring 'translation id undefined' erros ([bb5a2c4](https://github.com/angular-translate/angular-translate/commit/bb5a2c4))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add option to html escape all values ([fe94c1f](https://github.com/angular-translate/angular-translate/commit/fe94c1f))
|
|
||||||
* shortcuts and links\n\nShortcuts creates a shorter translationId if the last key ([f9f2cf2](https://github.com/angular-translate/angular-translate/commit/f9f2cf2))
|
|
||||||
* Update required Node up `0.10` ([b7cf5f4](https://github.com/angular-translate/angular-translate/commit/b7cf5f4))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="1.1.0"></a>
|
|
||||||
# [1.1.0](https://github.com/angular-translate/angular-translate/compare/1.0.2...1.1.0) (2013-09-02)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **translateDirective:** fixes bug that directive writes into scope ([4e06468](https://github.com/angular-translate/angular-translate/commit/4e06468)), closes [#128](https://github.com/angular-translate/angular-translate/issues/128)
|
|
||||||
* **translateDirective:** fixes scope handling ([c566586](https://github.com/angular-translate/angular-translate/commit/c566586))
|
|
||||||
* **translateService:** reset proposed language if there's no pending loader ([6b477fc](https://github.com/angular-translate/angular-translate/commit/6b477fc))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **$translatePartialLoader:** Basic implementation ([81222bf](https://github.com/angular-translate/angular-translate/commit/81222bf))
|
|
||||||
* **invalidate:** added invalidate() method ([d41f91e](https://github.com/angular-translate/angular-translate/commit/d41f91e))
|
|
||||||
* **translateProvider:** makes methods chainable ([cdc9e9e](https://github.com/angular-translate/angular-translate/commit/cdc9e9e))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="1.0.2"></a>
|
|
||||||
## [1.0.2](https://github.com/angular-translate/angular-translate/compare/1.0.1...1.0.2) (2013-08-07)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **fallbackLanguage:** fixes bug that fallbackLanguage is loaded without loader ([6aa3747](https://github.com/angular-translate/angular-translate/commit/6aa3747))
|
|
||||||
* **translateService:** uses should only load if a loader is registered ([604daec](https://github.com/angular-translate/angular-translate/commit/604daec))
|
|
||||||
* **typo:** remove unnecessary semicolon ([54cb232](https://github.com/angular-translate/angular-translate/commit/54cb232))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="1.0.1"></a>
|
|
||||||
## [1.0.1](https://github.com/angular-translate/angular-translate/compare/1.0.0...1.0.1) (2013-07-26)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **demo:** change src to angular-translate script ([4be93b6](https://github.com/angular-translate/angular-translate/commit/4be93b6))
|
|
||||||
* **dependency:** add 'angular-cookies' as bower devDependency ([b6f1426](https://github.com/angular-translate/angular-translate/commit/b6f1426))
|
|
||||||
* **platolink:** deep link ([d368bf3](https://github.com/angular-translate/angular-translate/commit/d368bf3))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="1.0.0"></a>
|
|
||||||
# [1.0.0](https://github.com/angular-translate/angular-translate/compare/0.9.4...1.0.0) (2013-07-23)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **docs:** fixes methodOf declaration of addInterpolation method ([f1eeba7](https://github.com/angular-translate/angular-translate/commit/f1eeba7))
|
|
||||||
* **gh-pages:** plato report ([b85e19b](https://github.com/angular-translate/angular-translate/commit/b85e19b))
|
|
||||||
* **tests:** travis CI ([c8624bf](https://github.com/angular-translate/angular-translate/commit/c8624bf))
|
|
||||||
* **tests:** travis CI ([629bb8d](https://github.com/angular-translate/angular-translate/commit/629bb8d))
|
|
||||||
* fixes gruntfile ([0d500db](https://github.com/angular-translate/angular-translate/commit/0d500db))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **messageformat-interpolation:** implements usage of messageformat ([5596e8b](https://github.com/angular-translate/angular-translate/commit/5596e8b))
|
|
||||||
* **translateDirective:** teaches directives to use custom interpolation ([bf3dbbb](https://github.com/angular-translate/angular-translate/commit/bf3dbbb))
|
|
||||||
* **translateFilter:** teaches filter to use custom interpolation ([46f03cc](https://github.com/angular-translate/angular-translate/commit/46f03cc))
|
|
||||||
* **translateService:** adds method to configure indicators for not found translations ([52a039f](https://github.com/angular-translate/angular-translate/commit/52a039f)), closes [#77](https://github.com/angular-translate/angular-translate/issues/77)
|
|
||||||
* **translateService:** extracts default interpolation in standalone service ([5d8cb56](https://github.com/angular-translate/angular-translate/commit/5d8cb56))
|
|
||||||
* **translateService:** implements proposedLanguage() ([6d34792](https://github.com/angular-translate/angular-translate/commit/6d34792))
|
|
||||||
* **translateService:** implements usage of different interpolation services ([5e20e24](https://github.com/angular-translate/angular-translate/commit/5e20e24))
|
|
||||||
* **translateService:** informs interpolator when locale has changed ([e59b141](https://github.com/angular-translate/angular-translate/commit/e59b141))
|
|
||||||
* **translateService:** missingTranslationHandler receives language ([6fe6bb1](https://github.com/angular-translate/angular-translate/commit/6fe6bb1))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.9.4"></a>
|
|
||||||
## [0.9.4](https://github.com/angular-translate/angular-translate/compare/0.9.3...0.9.4) (2013-06-21)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **translateService:** fixes missingTranslationHandler-invokation bug ([525b353](https://github.com/angular-translate/angular-translate/commit/525b353)), closes [#74](https://github.com/angular-translate/angular-translate/issues/74)
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **translateService:** removes empty options object requirement for loaders ([c09d1db](https://github.com/angular-translate/angular-translate/commit/c09d1db))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.9.3"></a>
|
|
||||||
## [0.9.3](https://github.com/angular-translate/angular-translate/compare/0.9.2...0.9.3) (2013-06-10)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **translateService:** let translate service handle multiple promises ([0e5d6d9](https://github.com/angular-translate/angular-translate/commit/0e5d6d9)), closes [#70](https://github.com/angular-translate/angular-translate/issues/70)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.9.2"></a>
|
|
||||||
## [0.9.2](https://github.com/angular-translate/angular-translate/compare/0.9.1...0.9.2) (2013-05-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* fix bower.json ([c389882](https://github.com/angular-translate/angular-translate/commit/c389882))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **translateProvider:** add fallbackLanguage() method ([018991e](https://github.com/angular-translate/angular-translate/commit/018991e)), closes [#67](https://github.com/angular-translate/angular-translate/issues/67)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.9.1"></a>
|
|
||||||
## [0.9.1](https://github.com/angular-translate/angular-translate/compare/0.9.0...0.9.1) (2013-05-25)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **translate.js:** Allow blank translation values ([97591a8](https://github.com/angular-translate/angular-translate/commit/97591a8))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.9.0"></a>
|
|
||||||
# [0.9.0](https://github.com/angular-translate/angular-translate/compare/0.8.1...0.9.0) (2013-05-22)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **translateProvider:** add use*() methods for async loaders ([f2329cc](https://github.com/angular-translate/angular-translate/commit/f2329cc)), closes [#58](https://github.com/angular-translate/angular-translate/issues/58)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.8.1"></a>
|
|
||||||
## [0.8.1](https://github.com/angular-translate/angular-translate/compare/0.8.0...0.8.1) (2013-05-16)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **translate.js:** corrected typo ([82569f0](https://github.com/angular-translate/angular-translate/commit/82569f0))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **translateProvider:** add methods to use different missingTranslationHandlers ([f6ed3e3](https://github.com/angular-translate/angular-translate/commit/f6ed3e3))
|
|
||||||
|
|
||||||
|
|
||||||
### BREAKING CHANGES
|
|
||||||
|
|
||||||
* S: missingTranslationHandler is no longer supported since its functionality will be replaced with useMissingTranslationHandlerLog.
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.8.0"></a>
|
|
||||||
# [0.8.0](https://github.com/angular-translate/angular-translate/compare/0.7.1...0.8.0) (2013-05-14)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.7.1"></a>
|
|
||||||
## [0.7.1](https://github.com/angular-translate/angular-translate/compare/0.7.0...0.7.1) (2013-05-13)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **chore:** rename ngTranslate folder to src ([65012d9](https://github.com/angular-translate/angular-translate/commit/65012d9))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.7.0"></a>
|
|
||||||
# [0.7.0](https://github.com/angular-translate/angular-translate/compare/0.6.0...0.7.0) (2013-05-12)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **directive:** trim off white space around element.text() ([e10173a](https://github.com/angular-translate/angular-translate/commit/e10173a))
|
|
||||||
* **tests:** Fix preferredLanguage tests ([73efcfc](https://github.com/angular-translate/angular-translate/commit/73efcfc))
|
|
||||||
* **tests:** fix tests for preferredLanguage() ([f1b5084](https://github.com/angular-translate/angular-translate/commit/f1b5084))
|
|
||||||
* **tests:** Old values won't be ignored, so they have to be discarded ([625b1d6](https://github.com/angular-translate/angular-translate/commit/625b1d6))
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* nested objects will be transformed when using `$translateProvider.translations` ([b15cee4](https://github.com/angular-translate/angular-translate/commit/b15cee4))
|
|
||||||
* **docs:** add documentation comments ([b1efbca](https://github.com/angular-translate/angular-translate/commit/b1efbca))
|
|
||||||
* **storageKey:** add a storageKey method ([dabf822](https://github.com/angular-translate/angular-translate/commit/dabf822))
|
|
||||||
* **translateProvider:** add a preferredLanguage property ([563e9bf](https://github.com/angular-translate/angular-translate/commit/563e9bf))
|
|
||||||
* **translateProvider:** add storagePrefix() method ([64cd99b](https://github.com/angular-translate/angular-translate/commit/64cd99b))
|
|
||||||
* **translateProvider:** add useLoaderFactory() as shortcut method ([2915e8b](https://github.com/angular-translate/angular-translate/commit/2915e8b))
|
|
||||||
* **translateProvider:** make translationTable extendable ([8e3a455](https://github.com/angular-translate/angular-translate/commit/8e3a455)), closes [#33](https://github.com/angular-translate/angular-translate/issues/33)
|
|
||||||
* **translateProvider:** missingTranslationHandler ([3a5819e](https://github.com/angular-translate/angular-translate/commit/3a5819e))
|
|
||||||
* **translateService:** add storage() method ([98c2b12](https://github.com/angular-translate/angular-translate/commit/98c2b12))
|
|
||||||
|
|
||||||
|
|
||||||
### BREAKING CHANGES
|
|
||||||
|
|
||||||
* The $STORAGE_KEY isn't represent a current storage key
|
|
||||||
from now. To discover which key is used now you have to call the storageKey
|
|
||||||
method without params.
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.6.0"></a>
|
|
||||||
# [0.6.0](https://github.com/angular-translate/angular-translate/compare/0.5.2...0.6.0) (2013-05-03)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **ngmin:** add grunt-ngmin ([f630958](https://github.com/angular-translate/angular-translate/commit/f630958)), closes [#20](https://github.com/angular-translate/angular-translate/issues/20)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.5.2"></a>
|
|
||||||
## [0.5.2](https://github.com/angular-translate/angular-translate/compare/0.5.1...0.5.2) (2013-04-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **translateDirective:** check for truthy value in watch callback ([98087c7](https://github.com/angular-translate/angular-translate/commit/98087c7)), closes [#18](https://github.com/angular-translate/angular-translate/issues/18)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.5.1"></a>
|
|
||||||
## [0.5.1](https://github.com/angular-translate/angular-translate/compare/0.5.0...0.5.1) (2013-04-29)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **.bowerrc:** add .bowerrc ([42363ee](https://github.com/angular-translate/angular-translate/commit/42363ee)), closes [#16](https://github.com/angular-translate/angular-translate/issues/16)
|
|
||||||
* **.jshintrc:** add .jshintrc ([0c8d3da](https://github.com/angular-translate/angular-translate/commit/0c8d3da)), closes [#17](https://github.com/angular-translate/angular-translate/issues/17)
|
|
||||||
* **bower.json:** rename component.json to bower.json ([17acd10](https://github.com/angular-translate/angular-translate/commit/17acd10))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.5.0"></a>
|
|
||||||
# [0.5.0](https://github.com/angular-translate/angular-translate/compare/0.4.4...0.5.0) (2013-04-25)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **conventional-changelogs:** Add grunt-conventional-changelog task ([c8093a7](https://github.com/angular-translate/angular-translate/commit/c8093a7)), closes [#11](https://github.com/angular-translate/angular-translate/issues/11)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.4.4"></a>
|
|
||||||
## [0.4.4](https://github.com/angular-translate/angular-translate/compare/0.4.2...0.4.4) (2013-04-23)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.4.2"></a>
|
|
||||||
## [0.4.2](https://github.com/angular-translate/angular-translate/compare/0.4.0...0.4.2) (2013-04-17)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.4.0"></a>
|
|
||||||
# [0.4.0](https://github.com/angular-translate/angular-translate/compare/0.3.0...0.4.0) (2013-04-07)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.3.0"></a>
|
|
||||||
# [0.3.0](https://github.com/angular-translate/angular-translate/compare/0.2.1...0.3.0) (2013-04-06)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.2.1"></a>
|
|
||||||
## [0.2.1](https://github.com/angular-translate/angular-translate/compare/0.2.0...0.2.1) (2013-04-05)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.2.0"></a>
|
|
||||||
# [0.2.0](https://github.com/angular-translate/angular-translate/compare/0.1.2...0.2.0) (2013-04-03)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.1.2"></a>
|
|
||||||
## [0.1.2](https://github.com/angular-translate/angular-translate/compare/0.1.1...0.1.2) (2013-04-02)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.1.1"></a>
|
|
||||||
## [0.1.1](https://github.com/angular-translate/angular-translate/compare/0.1.0...0.1.1) (2013-04-01)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.1.0"></a>
|
|
||||||
# [0.1.0](https://github.com/angular-translate/angular-translate/compare/0.0.5...0.1.0) (2013-04-01)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.0.5"></a>
|
|
||||||
## [0.0.5](https://github.com/angular-translate/angular-translate/compare/0.0.4...0.0.5) (2013-04-01)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.0.4"></a>
|
|
||||||
## [0.0.4](https://github.com/angular-translate/angular-translate/compare/0.0.2...0.0.4) (2013-04-01)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.0.2"></a>
|
|
||||||
## [0.0.2](https://github.com/angular-translate/angular-translate/compare/0.0.1...0.0.2) (2013-03-30)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.0.1"></a>
|
|
||||||
## 0.0.1 (2013-03-28)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2013-2017 The angular-translate team and Pascal Precht
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
|
@ -1,88 +0,0 @@
|
||||||
# [![angular-translate](https://raw.github.com/angular-translate/angular-translate/canary/identity/logo/angular-translate-alternative/angular-translate_alternative_medium2.png)](http://angular-translate.github.io)
|
|
||||||
|
|
||||||
![Bower](https://img.shields.io/bower/v/angular-translate.svg) [![NPM](https://img.shields.io/npm/v/angular-translate.svg)](https://www.npmjs.com/package/angular-translate) [![cdnjs](https://img.shields.io/cdnjs/v/angular-translate.svg)](https://cdnjs.com/libraries/angular-translate) [![Build Status](https://img.shields.io/travis/angular-translate/angular-translate.svg)](https://travis-ci.org/angular-translate/angular-translate) ![License](https://img.shields.io/npm/l/angular-translate.svg) ![Code Climate](https://img.shields.io/codeclimate/github/angular-translate/angular-translate.svg) ![Code Coverage](https://img.shields.io/codeclimate/coverage/github/angular-translate/angular-translate.svg)
|
|
||||||
|
|
||||||
This is the repository for angular-translate.
|
|
||||||
|
|
||||||
angular-translate is a JavaScript translation library for AngularJS 1.x app.
|
|
||||||
|
|
||||||
For more information about the angular-translate project, please visit our [website](https://angular-translate.github.io).
|
|
||||||
|
|
||||||
## Status
|
|
||||||
| Branch | Status |
|
|
||||||
| ------------- |:-------------:|
|
|
||||||
| master | [![Build Status](https://travis-ci.org/angular-translate/angular-translate.svg?branch=master)](https://travis-ci.org/angular-translate/angular-translate) |
|
|
||||||
| canary |[![Build Status](https://travis-ci.org/angular-translate/angular-translate.svg?branch=canary)](https://travis-ci.org/angular-translate/angular-translate) |
|
|
||||||
|
|
||||||
## Install
|
|
||||||
We strongly *recommend* using a package manager like NPM and Bower, or even variants like Yarn or jspm.
|
|
||||||
|
|
||||||
### NPM
|
|
||||||
```
|
|
||||||
npm install --save-dev angular-translate
|
|
||||||
```
|
|
||||||
|
|
||||||
### Bower
|
|
||||||
```
|
|
||||||
bower install --save-dev angular-translate
|
|
||||||
```
|
|
||||||
|
|
||||||
For more information please visit [chapter "Installation" at our website](https://angular-translate.github.io/docs/#/guide/00_installation).
|
|
||||||
|
|
||||||
## Get started
|
|
||||||
Check out out [chapter "Getting started" at out website](https://angular-translate.github.io/docs/#/guide/02_getting-started).
|
|
||||||
|
|
||||||
## Get support
|
|
||||||
Most of the time, we are getting support questions of invalid configurations. We encourage everyone to have a look at our [documentation website](https://angular-translate.github.io/docs/#/guide). If you think the documentation is not correct (bug) or should be optimized (enhancement) please file an issue.
|
|
||||||
|
|
||||||
If you are still having difficulty after looking over your configuration carefully, please post a question to [StackOverflow with a specific tag](http://stackoverflow.com/questions/tagged/angular-translate). Especially if the question are related to AngularJS or even JavaScript/browser basic technologies (maybe your issue is not related to angular-translate after all).
|
|
||||||
|
|
||||||
If you have discovered a bug or have a feature suggestion, feel free to create an issue on GitHub. Please follow the guideline within the issue template. See also next headline.
|
|
||||||
|
|
||||||
*Please note: We cannot provide support for neither JavaScript nor AngularJS itself. In both cases, a platform like StackOverflow is much more ideal.*
|
|
||||||
|
|
||||||
# Contribute
|
|
||||||
We got a lot of great feedback from the community so far! More and more people
|
|
||||||
use this module and they are always thankful for it and the awesome support they
|
|
||||||
get. I just want to make sure that you guys know: All this wouldn't have been
|
|
||||||
possible without these [great contributors](https://github.com/angular-translate/angular-translate/contributors)
|
|
||||||
and everybody who comes with new ideas and feature requests! So **THANK YOU**!
|
|
||||||
|
|
||||||
Contributing to <code>angular-translate</code> is fairly easy.
|
|
||||||
|
|
||||||
[This document](CONTRIBUTING.md) shows you how to
|
|
||||||
get the project, run all provided tests and generate a production ready build.
|
|
||||||
|
|
||||||
|
|
||||||
## Public talks
|
|
||||||
[![Dutch AngularJS Meetup 2013](presentation.png)](https://www.youtube.com/watch?v=9CWifOK_Wi8)
|
|
||||||
[![Kod.io 2014](presentation2.png)](https://www.youtube.com/watch?v=C7xqaExvaQ4)
|
|
||||||
|
|
||||||
### Links
|
|
||||||
* Website [angular-translate.github.io](https://angular-translate.github.io/)
|
|
||||||
* API Reference [angular-translate.github.io/docs/#/api](https://angular-translate.github.io/docs/#/api)
|
|
||||||
* [Contribution Guidelines](https://github.com/angular-translate/angular-translate/blob/master/CONTRIBUTING.md)
|
|
||||||
|
|
||||||
### Useful resources
|
|
||||||
There are some very useful things on the web that might be interesting for you,
|
|
||||||
so make sure to check this list.
|
|
||||||
|
|
||||||
- [Tutorial on ng-newsletter.com](http://ng-newsletter.com/posts/angular-translate.html)
|
|
||||||
- [Examples and demos](https://github.com/angular-translate/angular-translate/wiki/Demos) - Currently on plnkr.co
|
|
||||||
- [Tutorial on angularjs.de](http://angularjs.de/artikel/angularjs-i18n-ng-translate) - German article
|
|
||||||
- [angular-translate on GitHub](https://github.com/angular-translate/angular-translate) - The GitHub repository
|
|
||||||
- [angular-translate on ngmodules.org](http://ngmodules.org/modules/angular-translate)
|
|
||||||
- [angular-translate mailinglist](https://groups.google.com/forum/#!forum/angular-translate) - Discuss, ask et al!
|
|
||||||
- [angular-translate-quality](https://www.npmjs.com/package/angular-translate-quality) - Quality check at build time
|
|
||||||
|
|
||||||
## Tests
|
|
||||||
|
|
||||||
### Unit tests
|
|
||||||
|
|
||||||
Note: Check that dependencies are be installed (`npm install`).
|
|
||||||
|
|
||||||
The *unit tests* are available with `npm test` which is actually a shortcut for `grunt test`. It performs tests under the current primary target version of AngularJS. Use `npm run-script test-scopes` for testing other scoped versions as well.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
Licensed under MIT.
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 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 () {
|
|
||||||
|
|
||||||
$translateMissingTranslationHandlerLog.$inject = ['$log'];
|
|
||||||
angular.module('pascalprecht.translate')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc object
|
|
||||||
* @name pascalprecht.translate.$translateMissingTranslationHandlerLog
|
|
||||||
* @requires $log
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Uses angular's `$log` service to give a warning when trying to translate a
|
|
||||||
* translation id which doesn't exist.
|
|
||||||
*
|
|
||||||
* @returns {function} Handler function
|
|
||||||
*/
|
|
||||||
.factory('$translateMissingTranslationHandlerLog', $translateMissingTranslationHandlerLog);
|
|
||||||
|
|
||||||
function $translateMissingTranslationHandlerLog ($log) {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
return function (translationId) {
|
|
||||||
$log.warn('Translation for ' + translationId + ' doesn\'t exist');
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
$translateMissingTranslationHandlerLog.displayName = '$translateMissingTranslationHandlerLog';
|
|
||||||
return 'pascalprecht.translate';
|
|
||||||
|
|
||||||
}));
|
|
|
@ -1,6 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
|
||||||
*/
|
|
||||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a){"use strict";return function(b){a.warn("Translation for "+b+" doesn't exist")}}return a.$inject=["$log"],angular.module("pascalprecht.translate").factory("$translateMissingTranslationHandlerLog",a),a.displayName="$translateMissingTranslationHandlerLog","pascalprecht.translate"});
|
|
|
@ -1,197 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 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(["messageformat"], function (a0) {
|
|
||||||
return (factory(a0));
|
|
||||||
});
|
|
||||||
} 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(require("messageformat"));
|
|
||||||
} else {
|
|
||||||
factory(root["MessageFormat"]);
|
|
||||||
}
|
|
||||||
}(this, function (MessageFormat) {
|
|
||||||
|
|
||||||
angular.module('pascalprecht.translate')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc property
|
|
||||||
* @name pascalprecht.translate.TRANSLATE_MF_INTERPOLATION_CACHE
|
|
||||||
* @requires TRANSLATE_MF_INTERPOLATION_CACHE
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Uses MessageFormat.js to interpolate strings against some values.
|
|
||||||
*/
|
|
||||||
.constant('TRANSLATE_MF_INTERPOLATION_CACHE', '$translateMessageFormatInterpolation')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc object
|
|
||||||
* @name pascalprecht.translate.$translateMessageFormatInterpolationProvider
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Configurations for $translateMessageFormatInterpolation
|
|
||||||
*/
|
|
||||||
.provider('$translateMessageFormatInterpolation', $translateMessageFormatInterpolationProvider);
|
|
||||||
|
|
||||||
function $translateMessageFormatInterpolationProvider() {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var configurer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translateMessageFormatInterpolationProvider#messageFormatConfigurer
|
|
||||||
* @methodOf pascalprecht.translate.$translateMessageFormatInterpolationProvider
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Defines an optional configurer for the MessageFormat instance.
|
|
||||||
*
|
|
||||||
* Note: This hook will be called whenever a new instance of MessageFormat will be created.
|
|
||||||
*
|
|
||||||
* @param {function} fn callback with the instance as argument
|
|
||||||
*/
|
|
||||||
this.messageFormatConfigurer = function (fn) {
|
|
||||||
configurer = fn;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc object
|
|
||||||
* @name pascalprecht.translate.$translateMessageFormatInterpolation
|
|
||||||
* @requires pascalprecht.translate.TRANSLATE_MF_INTERPOLATION_CACHE
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Uses MessageFormat.js to interpolate strings against some values.
|
|
||||||
*
|
|
||||||
* Be aware to configure a proper sanitization strategy.
|
|
||||||
*
|
|
||||||
* See also:
|
|
||||||
* * {@link pascalprecht.translate.$translateSanitization}
|
|
||||||
* * {@link https://github.com/SlexAxton/messageformat.js}
|
|
||||||
*
|
|
||||||
* @return {object} $translateMessageFormatInterpolation Interpolator service
|
|
||||||
*/
|
|
||||||
this.$get = ['$translateSanitization', '$cacheFactory', 'TRANSLATE_MF_INTERPOLATION_CACHE', function ($translateSanitization, $cacheFactory, TRANSLATE_MF_INTERPOLATION_CACHE) {
|
|
||||||
return $translateMessageFormatInterpolation($translateSanitization, $cacheFactory, TRANSLATE_MF_INTERPOLATION_CACHE, configurer);
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function $translateMessageFormatInterpolation($translateSanitization, $cacheFactory, TRANSLATE_MF_INTERPOLATION_CACHE, messageFormatConfigurer) {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var $translateInterpolator = {},
|
|
||||||
$cache = $cacheFactory.get(TRANSLATE_MF_INTERPOLATION_CACHE),
|
|
||||||
// instantiate with default locale (which is 'en')
|
|
||||||
$mf = new MessageFormat('en'),
|
|
||||||
$identifier = 'messageformat';
|
|
||||||
|
|
||||||
if (angular.isFunction(messageFormatConfigurer)) {
|
|
||||||
messageFormatConfigurer($mf);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$cache) {
|
|
||||||
// create cache if it doesn't exist already
|
|
||||||
$cache = $cacheFactory(TRANSLATE_MF_INTERPOLATION_CACHE);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cache.put('en', $mf);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translateMessageFormatInterpolation#setLocale
|
|
||||||
* @methodOf pascalprecht.translate.$translateMessageFormatInterpolation
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Sets current locale (this is currently not use in this interpolation).
|
|
||||||
*
|
|
||||||
* @param {string} locale Language key or locale.
|
|
||||||
*/
|
|
||||||
$translateInterpolator.setLocale = function (locale) {
|
|
||||||
$mf = $cache.get(locale);
|
|
||||||
if (!$mf) {
|
|
||||||
$mf = new MessageFormat(locale);
|
|
||||||
if (angular.isFunction(messageFormatConfigurer)) {
|
|
||||||
messageFormatConfigurer($mf);
|
|
||||||
}
|
|
||||||
$cache.put(locale, $mf);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translateMessageFormatInterpolation#getInterpolationIdentifier
|
|
||||||
* @methodOf pascalprecht.translate.$translateMessageFormatInterpolation
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Returns an identifier for this interpolation service.
|
|
||||||
*
|
|
||||||
* @returns {string} $identifier
|
|
||||||
*/
|
|
||||||
$translateInterpolator.getInterpolationIdentifier = function () {
|
|
||||||
return $identifier;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated will be removed in 3.0
|
|
||||||
* @see {@link pascalprecht.translate.$translateSanitization}
|
|
||||||
*/
|
|
||||||
$translateInterpolator.useSanitizeValueStrategy = function (value) {
|
|
||||||
$translateSanitization.useStrategy(value);
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translateMessageFormatInterpolation#interpolate
|
|
||||||
* @methodOf pascalprecht.translate.$translateMessageFormatInterpolation
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Interpolates given string against given interpolate params using MessageFormat.js.
|
|
||||||
*
|
|
||||||
* @returns {string} interpolated string.
|
|
||||||
*/
|
|
||||||
$translateInterpolator.interpolate = function (string, interpolationParams, context, sanitizeStrategy) {
|
|
||||||
interpolationParams = interpolationParams || {};
|
|
||||||
interpolationParams = $translateSanitization.sanitize(interpolationParams, 'params', sanitizeStrategy);
|
|
||||||
|
|
||||||
var compiledFunction = $cache.get('mf:' + string);
|
|
||||||
|
|
||||||
// if given string wasn't compiled yet, we do so now and never have to do it again
|
|
||||||
if (!compiledFunction) {
|
|
||||||
|
|
||||||
// Ensure explicit type if possible
|
|
||||||
// MessageFormat checks the actual type (i.e. for amount based conditions)
|
|
||||||
for (var key in interpolationParams) {
|
|
||||||
if (interpolationParams.hasOwnProperty(key)) {
|
|
||||||
// ensure number
|
|
||||||
var number = parseInt(interpolationParams[key], 10);
|
|
||||||
if (angular.isNumber(number) && ('' + number) === interpolationParams[key]) {
|
|
||||||
interpolationParams[key] = number;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compiledFunction = $mf.compile(string);
|
|
||||||
$cache.put('mf:' + string, compiledFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
var interpolatedText = compiledFunction(interpolationParams);
|
|
||||||
return $translateSanitization.sanitize(interpolatedText, 'text', sanitizeStrategy);
|
|
||||||
};
|
|
||||||
|
|
||||||
return $translateInterpolator;
|
|
||||||
}
|
|
||||||
|
|
||||||
$translateMessageFormatInterpolation.displayName = '$translateMessageFormatInterpolation';
|
|
||||||
return 'pascalprecht.translate';
|
|
||||||
|
|
||||||
}));
|
|
|
@ -1,6 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
|
||||||
*/
|
|
||||||
!function(a,b){"function"==typeof define&&define.amd?define(["messageformat"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("messageformat")):b(a.MessageFormat)}(this,function(a){function b(){"use strict";var a;this.messageFormatConfigurer=function(b){a=b},this.$get=["$translateSanitization","$cacheFactory","TRANSLATE_MF_INTERPOLATION_CACHE",function(b,d,e){return c(b,d,e,a)}]}function c(b,c,d,e){"use strict";var f={},g=c.get(d),h=new a("en"),i="messageformat";return angular.isFunction(e)&&e(h),g||(g=c(d)),g.put("en",h),f.setLocale=function(b){h=g.get(b),h||(h=new a(b),angular.isFunction(e)&&e(h),g.put(b,h))},f.getInterpolationIdentifier=function(){return i},f.useSanitizeValueStrategy=function(a){return b.useStrategy(a),this},f.interpolate=function(a,c,d,e){c=c||{},c=b.sanitize(c,"params",e);var f=g.get("mf:"+a);if(!f){for(var i in c)if(c.hasOwnProperty(i)){var j=parseInt(c[i],10);angular.isNumber(j)&&""+j===c[i]&&(c[i]=j)}f=h.compile(a),g.put("mf:"+a,f)}var k=f(c);return b.sanitize(k,"text",e)},f}return angular.module("pascalprecht.translate").constant("TRANSLATE_MF_INTERPOLATION_CACHE","$translateMessageFormatInterpolation").provider("$translateMessageFormatInterpolation",b),c.displayName="$translateMessageFormatInterpolation","pascalprecht.translate"});
|
|
|
@ -1,557 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 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 () {
|
|
||||||
|
|
||||||
angular.module('pascalprecht.translate')
|
|
||||||
/**
|
|
||||||
* @ngdoc object
|
|
||||||
* @name pascalprecht.translate.$translatePartialLoaderProvider
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* By using a $translatePartialLoaderProvider you can configure a list of a needed
|
|
||||||
* translation parts directly during the configuration phase of your application's
|
|
||||||
* lifetime. All parts you add by using this provider would be loaded by
|
|
||||||
* angular-translate at the startup as soon as possible.
|
|
||||||
*/
|
|
||||||
.provider('$translatePartialLoader', $translatePartialLoader);
|
|
||||||
|
|
||||||
function $translatePartialLoader() {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
* @name Part
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Represents Part object to add and set parts at runtime.
|
|
||||||
*/
|
|
||||||
function Part(name, priority) {
|
|
||||||
this.name = name;
|
|
||||||
this.isActive = true;
|
|
||||||
this.tables = {};
|
|
||||||
this.priority = priority || 0;
|
|
||||||
this.langPromises = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name parseUrl
|
|
||||||
* @method
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Returns a parsed url template string and replaces given target lang
|
|
||||||
* and part name it.
|
|
||||||
*
|
|
||||||
* @param {string|function} urlTemplate - Either a string containing an url pattern (with
|
|
||||||
* '{part}' and '{lang}') or a function(part, lang)
|
|
||||||
* returning a string.
|
|
||||||
* @param {string} targetLang - Language key for language to be used.
|
|
||||||
* @return {string} Parsed url template string
|
|
||||||
*/
|
|
||||||
Part.prototype.parseUrl = function (urlTemplate, targetLang) {
|
|
||||||
if (angular.isFunction(urlTemplate)) {
|
|
||||||
return urlTemplate(this.name, targetLang);
|
|
||||||
}
|
|
||||||
return urlTemplate.replace(/\{part\}/g, this.name).replace(/\{lang\}/g, targetLang);
|
|
||||||
};
|
|
||||||
|
|
||||||
Part.prototype.getTable = function (lang, $q, $http, $httpOptions, urlTemplate, errorHandler) {
|
|
||||||
|
|
||||||
//locals
|
|
||||||
var self = this;
|
|
||||||
var lastLangPromise = this.langPromises[lang];
|
|
||||||
var deferred = $q.defer();
|
|
||||||
|
|
||||||
//private helper helpers
|
|
||||||
var fetchData = function () {
|
|
||||||
return $http(
|
|
||||||
angular.extend({
|
|
||||||
method : 'GET',
|
|
||||||
url : self.parseUrl(urlTemplate, lang)
|
|
||||||
},
|
|
||||||
$httpOptions)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
//private helper
|
|
||||||
var handleNewData = function (data) {
|
|
||||||
self.tables[lang] = data;
|
|
||||||
deferred.resolve(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
//private helper
|
|
||||||
var rejectDeferredWithPartName = function () {
|
|
||||||
deferred.reject(self.name);
|
|
||||||
};
|
|
||||||
|
|
||||||
//private helper
|
|
||||||
var tryGettingThisTable = function () {
|
|
||||||
//data fetching logic
|
|
||||||
fetchData().then(
|
|
||||||
function (result) {
|
|
||||||
handleNewData(result.data);
|
|
||||||
},
|
|
||||||
function (errorResponse) {
|
|
||||||
if (errorHandler) {
|
|
||||||
errorHandler(self.name, lang, errorResponse).then(handleNewData, rejectDeferredWithPartName);
|
|
||||||
} else {
|
|
||||||
rejectDeferredWithPartName();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//loading logic
|
|
||||||
if (!this.tables[lang]) {
|
|
||||||
//let's try loading the data
|
|
||||||
if (!lastLangPromise) {
|
|
||||||
//this is the first request - just go ahead and hit the server
|
|
||||||
tryGettingThisTable();
|
|
||||||
} else {
|
|
||||||
//this is an additional request after one or more unfinished or failed requests
|
|
||||||
//chain the deferred off the previous request's promise so that this request conditionally executes
|
|
||||||
//if the previous request succeeds then the result will be passed through, but if it fails then this request will try again and hit the server
|
|
||||||
lastLangPromise.then(deferred.resolve, tryGettingThisTable);
|
|
||||||
}
|
|
||||||
//retain a reference to the last promise so we can continue the chain if another request is made before any succeed
|
|
||||||
//you can picture the promise chain as a singly-linked list (formed by the .then handler queues) that's traversed by the execution context
|
|
||||||
this.langPromises[lang] = deferred.promise;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//the part has already been loaded - if lastLangPromise is also undefined then the table has been populated using setPart
|
|
||||||
//this breaks the promise chain because we're not tying langDeferred's outcome to a previous call's promise handler queues, but we don't care because there's no asynchronous execution context to keep track of anymore
|
|
||||||
deferred.resolve(this.tables[lang]);
|
|
||||||
}
|
|
||||||
return deferred.promise;
|
|
||||||
};
|
|
||||||
|
|
||||||
var parts = {};
|
|
||||||
|
|
||||||
function hasPart(name) {
|
|
||||||
return Object.prototype.hasOwnProperty.call(parts, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isStringValid(str) {
|
|
||||||
return angular.isString(str) && str !== '';
|
|
||||||
}
|
|
||||||
|
|
||||||
function isPartAvailable(name) {
|
|
||||||
if (!isStringValid(name)) {
|
|
||||||
throw new TypeError('Invalid type of a first argument, a non-empty string expected.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return (hasPart(name) && parts[name].isActive);
|
|
||||||
}
|
|
||||||
|
|
||||||
function deepExtend(dst, src) {
|
|
||||||
for (var property in src) {
|
|
||||||
if (src[property] && src[property].constructor &&
|
|
||||||
src[property].constructor === Object) {
|
|
||||||
dst[property] = dst[property] || {};
|
|
||||||
deepExtend(dst[property], src[property]);
|
|
||||||
} else {
|
|
||||||
dst[property] = src[property];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPrioritizedParts() {
|
|
||||||
var prioritizedParts = [];
|
|
||||||
for (var part in parts) {
|
|
||||||
if (parts[part].isActive) {
|
|
||||||
prioritizedParts.push(parts[part]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
prioritizedParts.sort(function (a, b) {
|
|
||||||
return a.priority - b.priority;
|
|
||||||
});
|
|
||||||
return prioritizedParts;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translatePartialLoaderProvider#addPart
|
|
||||||
* @methodOf pascalprecht.translate.$translatePartialLoaderProvider
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Registers a new part of the translation table to be loaded once the
|
|
||||||
* `angular-translate` gets into runtime phase. It does not actually load any
|
|
||||||
* translation data, but only registers a part to be loaded in the future.
|
|
||||||
*
|
|
||||||
* @param {string} name A name of the part to add
|
|
||||||
* @param {int} [priority=0] Sets the load priority of this part.
|
|
||||||
*
|
|
||||||
* @returns {object} $translatePartialLoaderProvider, so this method is chainable
|
|
||||||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param
|
|
||||||
* of the wrong type. Please, note that the `name` param has to be a
|
|
||||||
* non-empty **string**.
|
|
||||||
*/
|
|
||||||
this.addPart = function (name, priority) {
|
|
||||||
if (!isStringValid(name)) {
|
|
||||||
throw new TypeError('Couldn\'t add part, part name has to be a string!');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasPart(name)) {
|
|
||||||
parts[name] = new Part(name, priority);
|
|
||||||
}
|
|
||||||
parts[name].isActive = true;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdocs function
|
|
||||||
* @name pascalprecht.translate.$translatePartialLoaderProvider#setPart
|
|
||||||
* @methodOf pascalprecht.translate.$translatePartialLoaderProvider
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Sets a translation table to the specified part. This method does not make the
|
|
||||||
* specified part available, but only avoids loading this part from the server.
|
|
||||||
*
|
|
||||||
* @param {string} lang A language of the given translation table
|
|
||||||
* @param {string} part A name of the target part
|
|
||||||
* @param {object} table A translation table to set to the specified part
|
|
||||||
*
|
|
||||||
* @return {object} $translatePartialLoaderProvider, so this method is chainable
|
|
||||||
* @throws {TypeError} The method could throw a **TypeError** if you pass params
|
|
||||||
* of the wrong type. Please, note that the `lang` and `part` params have to be a
|
|
||||||
* non-empty **string**s and the `table` param has to be an object.
|
|
||||||
*/
|
|
||||||
this.setPart = function (lang, part, table) {
|
|
||||||
if (!isStringValid(lang)) {
|
|
||||||
throw new TypeError('Couldn\'t set part.`lang` parameter has to be a string!');
|
|
||||||
}
|
|
||||||
if (!isStringValid(part)) {
|
|
||||||
throw new TypeError('Couldn\'t set part.`part` parameter has to be a string!');
|
|
||||||
}
|
|
||||||
if (typeof table !== 'object' || table === null) {
|
|
||||||
throw new TypeError('Couldn\'t set part. `table` parameter has to be an object!');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasPart(part)) {
|
|
||||||
parts[part] = new Part(part);
|
|
||||||
parts[part].isActive = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
parts[part].tables[lang] = table;
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translatePartialLoaderProvider#deletePart
|
|
||||||
* @methodOf pascalprecht.translate.$translatePartialLoaderProvider
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Removes the previously added part of the translation data. So, `angular-translate` will not
|
|
||||||
* load it at the startup.
|
|
||||||
*
|
|
||||||
* @param {string} name A name of the part to delete
|
|
||||||
*
|
|
||||||
* @returns {object} $translatePartialLoaderProvider, so this method is chainable
|
|
||||||
*
|
|
||||||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong
|
|
||||||
* type. Please, note that the `name` param has to be a non-empty **string**.
|
|
||||||
*/
|
|
||||||
this.deletePart = function (name) {
|
|
||||||
if (!isStringValid(name)) {
|
|
||||||
throw new TypeError('Couldn\'t delete part, first arg has to be string.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasPart(name)) {
|
|
||||||
parts[name].isActive = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translatePartialLoaderProvider#isPartAvailable
|
|
||||||
* @methodOf pascalprecht.translate.$translatePartialLoaderProvider
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Checks if the specific part is available. A part becomes available after it was added by the
|
|
||||||
* `addPart` method. Available parts would be loaded from the server once the `angular-translate`
|
|
||||||
* asks the loader to that.
|
|
||||||
*
|
|
||||||
* @param {string} name A name of the part to check
|
|
||||||
*
|
|
||||||
* @returns {boolean} Returns **true** if the part is available now and **false** if not.
|
|
||||||
*
|
|
||||||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong
|
|
||||||
* type. Please, note that the `name` param has to be a non-empty **string**.
|
|
||||||
*/
|
|
||||||
this.isPartAvailable = isPartAvailable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc object
|
|
||||||
* @name pascalprecht.translate.$translatePartialLoader
|
|
||||||
*
|
|
||||||
* @requires $q
|
|
||||||
* @requires $http
|
|
||||||
* @requires $injector
|
|
||||||
* @requires $rootScope
|
|
||||||
* @requires $translate
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
*
|
|
||||||
* @param {object} options Options object
|
|
||||||
*
|
|
||||||
* @throws {TypeError}
|
|
||||||
*/
|
|
||||||
this.$get = ['$rootScope', '$injector', '$q', '$http',
|
|
||||||
function ($rootScope, $injector, $q, $http) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc event
|
|
||||||
* @name pascalprecht.translate.$translatePartialLoader#$translatePartialLoaderStructureChanged
|
|
||||||
* @eventOf pascalprecht.translate.$translatePartialLoader
|
|
||||||
* @eventType broadcast on root scope
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* A $translatePartialLoaderStructureChanged event is called when a state of the loader was
|
|
||||||
* changed somehow. It could mean either some part is added or some part is deleted. Anyway when
|
|
||||||
* you get this event the translation table is not longer current and has to be updated.
|
|
||||||
*
|
|
||||||
* @param {string} name A name of the part which is a reason why the event was fired
|
|
||||||
*/
|
|
||||||
|
|
||||||
var service = function (options) {
|
|
||||||
if (!isStringValid(options.key)) {
|
|
||||||
throw new TypeError('Unable to load data, a key is not a non-empty string.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isStringValid(options.urlTemplate) && !angular.isFunction(options.urlTemplate)) {
|
|
||||||
throw new TypeError('Unable to load data, a urlTemplate is not a non-empty string or not a function.');
|
|
||||||
}
|
|
||||||
|
|
||||||
var errorHandler = options.loadFailureHandler;
|
|
||||||
if (errorHandler !== undefined) {
|
|
||||||
if (!angular.isString(errorHandler)) {
|
|
||||||
throw new Error('Unable to load data, a loadFailureHandler is not a string.');
|
|
||||||
} else {
|
|
||||||
errorHandler = $injector.get(errorHandler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var loaders = [],
|
|
||||||
prioritizedParts = getPrioritizedParts();
|
|
||||||
|
|
||||||
angular.forEach(prioritizedParts, function (part) {
|
|
||||||
loaders.push(
|
|
||||||
part.getTable(options.key, $q, $http, options.$http, options.urlTemplate, errorHandler)
|
|
||||||
);
|
|
||||||
part.urlTemplate = options.urlTemplate;
|
|
||||||
});
|
|
||||||
|
|
||||||
return $q.all(loaders)
|
|
||||||
.then(function () {
|
|
||||||
var table = {};
|
|
||||||
prioritizedParts = getPrioritizedParts();
|
|
||||||
angular.forEach(prioritizedParts, function (part) {
|
|
||||||
deepExtend(table, part.tables[options.key]);
|
|
||||||
});
|
|
||||||
return table;
|
|
||||||
}, function () {
|
|
||||||
return $q.reject(options.key);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translatePartialLoader#addPart
|
|
||||||
* @methodOf pascalprecht.translate.$translatePartialLoader
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Registers a new part of the translation table. This method does not actually perform any xhr
|
|
||||||
* requests to get translation data. The new parts will be loaded in order of priority from the server next time
|
|
||||||
* `angular-translate` asks the loader to load translations.
|
|
||||||
*
|
|
||||||
* @param {string} name A name of the part to add
|
|
||||||
* @param {int} [priority=0] Sets the load priority of this part.
|
|
||||||
*
|
|
||||||
* @returns {object} $translatePartialLoader, so this method is chainable
|
|
||||||
*
|
|
||||||
* @fires {$translatePartialLoaderStructureChanged} The $translatePartialLoaderStructureChanged
|
|
||||||
* event would be fired by this method in case the new part affected somehow on the loaders
|
|
||||||
* state. This way it means that there are a new translation data available to be loaded from
|
|
||||||
* the server.
|
|
||||||
*
|
|
||||||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong
|
|
||||||
* type. Please, note that the `name` param has to be a non-empty **string**.
|
|
||||||
*/
|
|
||||||
service.addPart = function (name, priority) {
|
|
||||||
if (!isStringValid(name)) {
|
|
||||||
throw new TypeError('Couldn\'t add part, first arg has to be a string');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasPart(name)) {
|
|
||||||
parts[name] = new Part(name, priority);
|
|
||||||
$rootScope.$emit('$translatePartialLoaderStructureChanged', name);
|
|
||||||
} else if (!parts[name].isActive) {
|
|
||||||
parts[name].isActive = true;
|
|
||||||
$rootScope.$emit('$translatePartialLoaderStructureChanged', name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return service;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translatePartialLoader#deletePart
|
|
||||||
* @methodOf pascalprecht.translate.$translatePartialLoader
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Deletes the previously added part of the translation data. The target part could be deleted
|
|
||||||
* either logically or physically. When the data is deleted logically it is not actually deleted
|
|
||||||
* from the browser, but the loader marks it as not active and prevents it from affecting on the
|
|
||||||
* translations. If the deleted in such way part is added again, the loader will use the
|
|
||||||
* previously loaded data rather than loading it from the server once more time. But if the data
|
|
||||||
* is deleted physically, the loader will completely remove all information about it. So in case
|
|
||||||
* of recycling this part will be loaded from the server again.
|
|
||||||
*
|
|
||||||
* @param {string} name A name of the part to delete
|
|
||||||
* @param {boolean=} [removeData=false] An indicator if the loader has to remove a loaded
|
|
||||||
* translation data physically. If the `removeData` if set to **false** the loaded data will not be
|
|
||||||
* deleted physically and might be reused in the future to prevent an additional xhr requests.
|
|
||||||
*
|
|
||||||
* @returns {object} $translatePartialLoader, so this method is chainable
|
|
||||||
*
|
|
||||||
* @fires {$translatePartialLoaderStructureChanged} The $translatePartialLoaderStructureChanged
|
|
||||||
* event would be fired by this method in case a part deletion process affects somehow on the
|
|
||||||
* loaders state. This way it means that some part of the translation data is now deprecated and
|
|
||||||
* the translation table has to be recompiled with the remaining translation parts.
|
|
||||||
*
|
|
||||||
* @throws {TypeError} The method could throw a **TypeError** if you pass some param of the
|
|
||||||
* wrong type. Please, note that the `name` param has to be a non-empty **string** and
|
|
||||||
* the `removeData` param has to be either **undefined** or **boolean**.
|
|
||||||
*/
|
|
||||||
service.deletePart = function (name, removeData) {
|
|
||||||
if (!isStringValid(name)) {
|
|
||||||
throw new TypeError('Couldn\'t delete part, first arg has to be string');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (removeData === undefined) {
|
|
||||||
removeData = false;
|
|
||||||
} else if (typeof removeData !== 'boolean') {
|
|
||||||
throw new TypeError('Invalid type of a second argument, a boolean expected.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasPart(name)) {
|
|
||||||
var wasActive = parts[name].isActive;
|
|
||||||
if (removeData) {
|
|
||||||
var $translate = $injector.get('$translate');
|
|
||||||
var cache = $translate.loaderCache();
|
|
||||||
if (typeof(cache) === 'string') {
|
|
||||||
// getting on-demand instance of loader
|
|
||||||
cache = $injector.get(cache);
|
|
||||||
}
|
|
||||||
// Purging items from cache...
|
|
||||||
if (typeof(cache) === 'object') {
|
|
||||||
angular.forEach(parts[name].tables, function (value, key) {
|
|
||||||
cache.remove(parts[name].parseUrl(parts[name].urlTemplate, key));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
delete parts[name];
|
|
||||||
} else {
|
|
||||||
parts[name].isActive = false;
|
|
||||||
}
|
|
||||||
if (wasActive) {
|
|
||||||
$rootScope.$emit('$translatePartialLoaderStructureChanged', name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return service;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translatePartialLoader#isPartLoaded
|
|
||||||
* @methodOf pascalprecht.translate.$translatePartialLoader
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Checks if the registered translation part is loaded into the translation table.
|
|
||||||
*
|
|
||||||
* @param {string} name A name of the part
|
|
||||||
* @param {string} lang A key of the language
|
|
||||||
*
|
|
||||||
* @returns {boolean} Returns **true** if the translation of the part is loaded to the translation table and **false** if not.
|
|
||||||
*
|
|
||||||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong
|
|
||||||
* type. Please, note that the `name` and `lang` params have to be non-empty **string**.
|
|
||||||
*/
|
|
||||||
service.isPartLoaded = function (name, lang) {
|
|
||||||
return angular.isDefined(parts[name]) && angular.isDefined(parts[name].tables[lang]);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translatePartialLoader#getRegisteredParts
|
|
||||||
* @methodOf pascalprecht.translate.$translatePartialLoader
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Gets names of the parts that were added with the `addPart`.
|
|
||||||
*
|
|
||||||
* @returns {array} Returns array of registered parts, if none were registered then an empty array is returned.
|
|
||||||
*/
|
|
||||||
service.getRegisteredParts = function () {
|
|
||||||
var registeredParts = [];
|
|
||||||
angular.forEach(parts, function (p) {
|
|
||||||
if (p.isActive) {
|
|
||||||
registeredParts.push(p.name);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return registeredParts;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translatePartialLoader#isPartAvailable
|
|
||||||
* @methodOf pascalprecht.translate.$translatePartialLoader
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Checks if a target translation part is available. The part becomes available just after it was
|
|
||||||
* added by the `addPart` method. Part's availability does not mean that it was loaded from the
|
|
||||||
* server, but only that it was added to the loader. The available part might be loaded next
|
|
||||||
* time the loader is called.
|
|
||||||
*
|
|
||||||
* @param {string} name A name of the part to delete
|
|
||||||
*
|
|
||||||
* @returns {boolean} Returns **true** if the part is available now and **false** if not.
|
|
||||||
*
|
|
||||||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong
|
|
||||||
* type. Please, note that the `name` param has to be a non-empty **string**.
|
|
||||||
*/
|
|
||||||
service.isPartAvailable = isPartAvailable;
|
|
||||||
|
|
||||||
return service;
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$translatePartialLoader.displayName = '$translatePartialLoader';
|
|
||||||
return 'pascalprecht.translate';
|
|
||||||
|
|
||||||
}));
|
|
|
@ -1,6 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
|
||||||
*/
|
|
||||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(){"use strict";function a(a,b){this.name=a,this.isActive=!0,this.tables={},this.priority=b||0,this.langPromises={}}function b(a){return Object.prototype.hasOwnProperty.call(g,a)}function c(a){return angular.isString(a)&&""!==a}function d(a){if(!c(a))throw new TypeError("Invalid type of a first argument, a non-empty string expected.");return b(a)&&g[a].isActive}function e(a,b){for(var c in b)b[c]&&b[c].constructor&&b[c].constructor===Object?(a[c]=a[c]||{},e(a[c],b[c])):a[c]=b[c];return a}function f(){var a=[];for(var b in g)g[b].isActive&&a.push(g[b]);return a.sort(function(a,b){return a.priority-b.priority}),a}a.prototype.parseUrl=function(a,b){return angular.isFunction(a)?a(this.name,b):a.replace(/\{part\}/g,this.name).replace(/\{lang\}/g,b)},a.prototype.getTable=function(a,b,c,d,e,f){var g=this,h=this.langPromises[a],i=b.defer(),j=function(){return c(angular.extend({method:"GET",url:g.parseUrl(e,a)},d))},k=function(b){g.tables[a]=b,i.resolve(b)},l=function(){i.reject(g.name)},m=function(){j().then(function(a){k(a.data)},function(b){f?f(g.name,a,b).then(k,l):l()})};return this.tables[a]?i.resolve(this.tables[a]):(h?h.then(i.resolve,m):m(),this.langPromises[a]=i.promise),i.promise};var g={};this.addPart=function(d,e){if(!c(d))throw new TypeError("Couldn't add part, part name has to be a string!");return b(d)||(g[d]=new a(d,e)),g[d].isActive=!0,this},this.setPart=function(d,e,f){if(!c(d))throw new TypeError("Couldn't set part.`lang` parameter has to be a string!");if(!c(e))throw new TypeError("Couldn't set part.`part` parameter has to be a string!");if("object"!=typeof f||null===f)throw new TypeError("Couldn't set part. `table` parameter has to be an object!");return b(e)||(g[e]=new a(e),g[e].isActive=!1),g[e].tables[d]=f,this},this.deletePart=function(a){if(!c(a))throw new TypeError("Couldn't delete part, first arg has to be string.");return b(a)&&(g[a].isActive=!1),this},this.isPartAvailable=d,this.$get=["$rootScope","$injector","$q","$http",function(h,i,j,k){var l=function(a){if(!c(a.key))throw new TypeError("Unable to load data, a key is not a non-empty string.");if(!c(a.urlTemplate)&&!angular.isFunction(a.urlTemplate))throw new TypeError("Unable to load data, a urlTemplate is not a non-empty string or not a function.");var b=a.loadFailureHandler;if(void 0!==b){if(!angular.isString(b))throw new Error("Unable to load data, a loadFailureHandler is not a string.");b=i.get(b)}var d=[],g=f();return angular.forEach(g,function(c){d.push(c.getTable(a.key,j,k,a.$http,a.urlTemplate,b)),c.urlTemplate=a.urlTemplate}),j.all(d).then(function(){var b={};return g=f(),angular.forEach(g,function(c){e(b,c.tables[a.key])}),b},function(){return j.reject(a.key)})};return l.addPart=function(d,e){if(!c(d))throw new TypeError("Couldn't add part, first arg has to be a string");return b(d)?g[d].isActive||(g[d].isActive=!0,h.$emit("$translatePartialLoaderStructureChanged",d)):(g[d]=new a(d,e),h.$emit("$translatePartialLoaderStructureChanged",d)),l},l.deletePart=function(a,d){if(!c(a))throw new TypeError("Couldn't delete part, first arg has to be string");if(void 0===d)d=!1;else if("boolean"!=typeof d)throw new TypeError("Invalid type of a second argument, a boolean expected.");if(b(a)){var e=g[a].isActive;if(d){var f=i.get("$translate"),j=f.loaderCache();"string"==typeof j&&(j=i.get(j)),"object"==typeof j&&angular.forEach(g[a].tables,function(b,c){j.remove(g[a].parseUrl(g[a].urlTemplate,c))}),delete g[a]}else g[a].isActive=!1;e&&h.$emit("$translatePartialLoaderStructureChanged",a)}return l},l.isPartLoaded=function(a,b){return angular.isDefined(g[a])&&angular.isDefined(g[a].tables[b])},l.getRegisteredParts=function(){var a=[];return angular.forEach(g,function(b){b.isActive&&a.push(b.name)}),a},l.isPartAvailable=d,l}]}return angular.module("pascalprecht.translate").provider("$translatePartialLoader",a),a.displayName="$translatePartialLoader","pascalprecht.translate"});
|
|
|
@ -1,112 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 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 () {
|
|
||||||
|
|
||||||
$translateStaticFilesLoader.$inject = ['$q', '$http'];
|
|
||||||
angular.module('pascalprecht.translate')
|
|
||||||
/**
|
|
||||||
* @ngdoc object
|
|
||||||
* @name pascalprecht.translate.$translateStaticFilesLoader
|
|
||||||
* @requires $q
|
|
||||||
* @requires $http
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Creates a loading function for a typical static file url pattern:
|
|
||||||
* "lang-en_US.json", "lang-de_DE.json", etc. Using this builder,
|
|
||||||
* the response of these urls must be an object of key-value pairs.
|
|
||||||
*
|
|
||||||
* @param {object} options Options object, which gets prefix, suffix, key, and fileMap
|
|
||||||
*/
|
|
||||||
.factory('$translateStaticFilesLoader', $translateStaticFilesLoader);
|
|
||||||
|
|
||||||
function $translateStaticFilesLoader($q, $http) {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
return function (options) {
|
|
||||||
|
|
||||||
if (!options || (!angular.isArray(options.files) && (!angular.isString(options.prefix) || !angular.isString(options.suffix)))) {
|
|
||||||
throw new Error('Couldn\'t load static files, no files and prefix or suffix specified!');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!options.files) {
|
|
||||||
options.files = [{
|
|
||||||
prefix: options.prefix,
|
|
||||||
suffix: options.suffix
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
var load = function (file) {
|
|
||||||
if (!file || (!angular.isString(file.prefix) || !angular.isString(file.suffix))) {
|
|
||||||
throw new Error('Couldn\'t load static file, no prefix or suffix specified!');
|
|
||||||
}
|
|
||||||
|
|
||||||
var fileUrl = [
|
|
||||||
file.prefix,
|
|
||||||
options.key,
|
|
||||||
file.suffix
|
|
||||||
].join('');
|
|
||||||
|
|
||||||
if (angular.isObject(options.fileMap) && options.fileMap[fileUrl]) {
|
|
||||||
fileUrl = options.fileMap[fileUrl];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $http(angular.extend({
|
|
||||||
url: fileUrl,
|
|
||||||
method: 'GET'
|
|
||||||
}, options.$http))
|
|
||||||
.then(function(result) {
|
|
||||||
return result.data;
|
|
||||||
}, function () {
|
|
||||||
return $q.reject(options.key);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
var promises = [],
|
|
||||||
length = options.files.length;
|
|
||||||
|
|
||||||
for (var i = 0; i < length; i++) {
|
|
||||||
promises.push(load({
|
|
||||||
prefix: options.files[i].prefix,
|
|
||||||
key: options.key,
|
|
||||||
suffix: options.files[i].suffix
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $q.all(promises)
|
|
||||||
.then(function (data) {
|
|
||||||
var length = data.length,
|
|
||||||
mergedData = {};
|
|
||||||
|
|
||||||
for (var i = 0; i < length; i++) {
|
|
||||||
for (var key in data[i]) {
|
|
||||||
mergedData[key] = data[i][key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mergedData;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
$translateStaticFilesLoader.displayName = '$translateStaticFilesLoader';
|
|
||||||
return 'pascalprecht.translate';
|
|
||||||
|
|
||||||
}));
|
|
|
@ -1,6 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
|
||||||
*/
|
|
||||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a,b){"use strict";return function(c){if(!(c&&(angular.isArray(c.files)||angular.isString(c.prefix)&&angular.isString(c.suffix))))throw new Error("Couldn't load static files, no files and prefix or suffix specified!");c.files||(c.files=[{prefix:c.prefix,suffix:c.suffix}]);for(var d=function(d){if(!d||!angular.isString(d.prefix)||!angular.isString(d.suffix))throw new Error("Couldn't load static file, no prefix or suffix specified!");var e=[d.prefix,c.key,d.suffix].join("");return angular.isObject(c.fileMap)&&c.fileMap[e]&&(e=c.fileMap[e]),b(angular.extend({url:e,method:"GET"},c.$http)).then(function(a){return a.data},function(){return a.reject(c.key)})},e=[],f=c.files.length,g=0;g<f;g++)e.push(d({prefix:c.files[g].prefix,key:c.key,suffix:c.files[g].suffix}));return a.all(e).then(function(a){for(var b=a.length,c={},d=0;d<b;d++)for(var e in a[d])c[e]=a[d][e];return c})}}return a.$inject=["$q","$http"],angular.module("pascalprecht.translate").factory("$translateStaticFilesLoader",a),a.displayName="$translateStaticFilesLoader","pascalprecht.translate"});
|
|
|
@ -1,73 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 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';
|
|
||||||
|
|
||||||
}));
|
|
|
@ -1,6 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
|
||||||
*/
|
|
||||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a,b){"use strict";return function(c){if(!c||!c.url)throw new Error("Couldn't use urlLoader since no url is given!");var d={};return d[c.queryParameter||"lang"]=c.key,b(angular.extend({url:c.url,params:d,method:"GET"},c.$http)).then(function(a){return a.data},function(){return a.reject(c.key)})}}return a.$inject=["$q","$http"],angular.module("pascalprecht.translate").factory("$translateUrlLoader",a),a.displayName="$translateUrlLoader","pascalprecht.translate"});
|
|
|
@ -1,121 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 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 () {
|
|
||||||
|
|
||||||
$translateCookieStorageFactory.$inject = ['$injector'];
|
|
||||||
angular.module('pascalprecht.translate')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc object
|
|
||||||
* @name pascalprecht.translate.$translateCookieStorage
|
|
||||||
* @requires $cookieStore
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Abstraction layer for cookieStore. This service is used when telling angular-translate
|
|
||||||
* to use cookieStore as storage.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
.factory('$translateCookieStorage', $translateCookieStorageFactory);
|
|
||||||
|
|
||||||
function $translateCookieStorageFactory($injector) {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// Since AngularJS 1.4, $cookieStore is deprecated
|
|
||||||
var delegate;
|
|
||||||
if (angular.version.major === 1 && angular.version.minor >= 4) {
|
|
||||||
var $cookies = $injector.get('$cookies');
|
|
||||||
delegate = {
|
|
||||||
get : function (key) {
|
|
||||||
return $cookies.get(key);
|
|
||||||
},
|
|
||||||
put : function (key, value) {
|
|
||||||
$cookies.put(key, value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
var $cookieStore = $injector.get('$cookieStore');
|
|
||||||
delegate = {
|
|
||||||
get : function (key) {
|
|
||||||
return $cookieStore.get(key);
|
|
||||||
},
|
|
||||||
put : function (key, value) {
|
|
||||||
$cookieStore.put(key, value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var $translateCookieStorage = {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translateCookieStorage#get
|
|
||||||
* @methodOf pascalprecht.translate.$translateCookieStorage
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Returns an item from cookieStorage by given name.
|
|
||||||
*
|
|
||||||
* @param {string} name Item name
|
|
||||||
* @return {string} Value of item name
|
|
||||||
*/
|
|
||||||
get : function (name) {
|
|
||||||
return delegate.get(name);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translateCookieStorage#set
|
|
||||||
* @methodOf pascalprecht.translate.$translateCookieStorage
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Sets an item in cookieStorage by given name.
|
|
||||||
*
|
|
||||||
* @deprecated use #put
|
|
||||||
*
|
|
||||||
* @param {string} name Item name
|
|
||||||
* @param {string} value Item value
|
|
||||||
*/
|
|
||||||
set : function (name, value) {
|
|
||||||
delegate.put(name, value);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translateCookieStorage#put
|
|
||||||
* @methodOf pascalprecht.translate.$translateCookieStorage
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Sets an item in cookieStorage by given name.
|
|
||||||
*
|
|
||||||
* @param {string} name Item name
|
|
||||||
* @param {string} value Item value
|
|
||||||
*/
|
|
||||||
put : function (name, value) {
|
|
||||||
delegate.put(name, value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return $translateCookieStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
$translateCookieStorageFactory.displayName = '$translateCookieStorage';
|
|
||||||
return 'pascalprecht.translate';
|
|
||||||
|
|
||||||
}));
|
|
|
@ -1,6 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
|
||||||
*/
|
|
||||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a){"use strict";var b;if(1===angular.version.major&&angular.version.minor>=4){var c=a.get("$cookies");b={get:function(a){return c.get(a)},put:function(a,b){c.put(a,b)}}}else{var d=a.get("$cookieStore");b={get:function(a){return d.get(a)},put:function(a,b){d.put(a,b)}}}var e={get:function(a){return b.get(a)},set:function(a,c){b.put(a,c)},put:function(a,c){b.put(a,c)}};return e}return a.$inject=["$injector"],angular.module("pascalprecht.translate").factory("$translateCookieStorage",a),a.displayName="$translateCookieStorage","pascalprecht.translate"});
|
|
|
@ -1,123 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 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 () {
|
|
||||||
|
|
||||||
$translateLocalStorageFactory.$inject = ['$window', '$translateCookieStorage'];
|
|
||||||
angular.module('pascalprecht.translate')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc object
|
|
||||||
* @name pascalprecht.translate.$translateLocalStorage
|
|
||||||
* @requires $window
|
|
||||||
* @requires $translateCookieStorage
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Abstraction layer for localStorage. This service is used when telling angular-translate
|
|
||||||
* to use localStorage as storage.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
.factory('$translateLocalStorage', $translateLocalStorageFactory);
|
|
||||||
|
|
||||||
function $translateLocalStorageFactory($window, $translateCookieStorage) {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// Setup adapter
|
|
||||||
var localStorageAdapter = (function(){
|
|
||||||
var langKey;
|
|
||||||
return {
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translateLocalStorage#get
|
|
||||||
* @methodOf pascalprecht.translate.$translateLocalStorage
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Returns an item from localStorage by given name.
|
|
||||||
*
|
|
||||||
* @param {string} name Item name
|
|
||||||
* @return {string} Value of item name
|
|
||||||
*/
|
|
||||||
get: function (name) {
|
|
||||||
if(!langKey) {
|
|
||||||
langKey = $window.localStorage.getItem(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return langKey;
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translateLocalStorage#set
|
|
||||||
* @methodOf pascalprecht.translate.$translateLocalStorage
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Sets an item in localStorage by given name.
|
|
||||||
*
|
|
||||||
* @deprecated use #put
|
|
||||||
*
|
|
||||||
* @param {string} name Item name
|
|
||||||
* @param {string} value Item value
|
|
||||||
*/
|
|
||||||
set: function (name, value) {
|
|
||||||
langKey=value;
|
|
||||||
$window.localStorage.setItem(name, value);
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* @ngdoc function
|
|
||||||
* @name pascalprecht.translate.$translateLocalStorage#put
|
|
||||||
* @methodOf pascalprecht.translate.$translateLocalStorage
|
|
||||||
*
|
|
||||||
* @description
|
|
||||||
* Sets an item in localStorage by given name.
|
|
||||||
*
|
|
||||||
* @param {string} name Item name
|
|
||||||
* @param {string} value Item value
|
|
||||||
*/
|
|
||||||
put: function (name, value) {
|
|
||||||
langKey=value;
|
|
||||||
$window.localStorage.setItem(name, value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}());
|
|
||||||
|
|
||||||
var hasLocalStorageSupport = 'localStorage' in $window;
|
|
||||||
if (hasLocalStorageSupport) {
|
|
||||||
var testKey = 'pascalprecht.translate.storageTest';
|
|
||||||
try {
|
|
||||||
// this check have to be wrapped within a try/catch because on
|
|
||||||
// a SecurityError: Dom Exception 18 on iOS
|
|
||||||
if ($window.localStorage !== null) {
|
|
||||||
$window.localStorage.setItem(testKey, 'foo');
|
|
||||||
$window.localStorage.removeItem(testKey);
|
|
||||||
hasLocalStorageSupport = true;
|
|
||||||
} else {
|
|
||||||
hasLocalStorageSupport = false;
|
|
||||||
}
|
|
||||||
} catch (e){
|
|
||||||
hasLocalStorageSupport = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var $translateLocalStorage = hasLocalStorageSupport ? localStorageAdapter : $translateCookieStorage;
|
|
||||||
return $translateLocalStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
$translateLocalStorageFactory.displayName = '$translateLocalStorageFactory';
|
|
||||||
return 'pascalprecht.translate';
|
|
||||||
|
|
||||||
}));
|
|
|
@ -1,6 +0,0 @@
|
||||||
/*!
|
|
||||||
* angular-translate - v2.15.1 - 2017-03-04
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
|
||||||
*/
|
|
||||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a,b){"use strict";var c=function(){var b;return{get:function(c){return b||(b=a.localStorage.getItem(c)),b},set:function(c,d){b=d,a.localStorage.setItem(c,d)},put:function(c,d){b=d,a.localStorage.setItem(c,d)}}}(),d="localStorage"in a;if(d){var e="pascalprecht.translate.storageTest";try{null!==a.localStorage?(a.localStorage.setItem(e,"foo"),a.localStorage.removeItem(e),d=!0):d=!1}catch(a){d=!1}}var f=d?c:b;return f}return a.$inject=["$window","$translateCookieStorage"],angular.module("pascalprecht.translate").factory("$translateLocalStorage",a),a.displayName="$translateLocalStorageFactory","pascalprecht.translate"});
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -1,107 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-translate",
|
|
||||||
"version": "2.15.1",
|
|
||||||
"description": "A translation module for AngularJS",
|
|
||||||
"main": "dist/angular-translate.js",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "http://github.com/angular-translate/angular-translate"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"angular-translate",
|
|
||||||
"angular",
|
|
||||||
"AngularJS",
|
|
||||||
"translation"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
},
|
|
||||||
"devEngines": {
|
|
||||||
"node": ">=6.9",
|
|
||||||
"npm": ">=3"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"prepublish": "bower install",
|
|
||||||
"check-env": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json",
|
|
||||||
"shipit": "npm run-script -s check-env && bower install && bower update && grunt prepare-release",
|
|
||||||
"lint": "grunt lint",
|
|
||||||
"test": "npm run-script -s check-env && grunt install-test && grunt test",
|
|
||||||
"test-headless": "npm run-script -s check-env && grunt test-headless",
|
|
||||||
"test-scopes": "npm run-script -s check-env && grunt install-test && for f in test_scopes/*; do TEST_SCOPE=\"`basename $f`\" grunt test; done",
|
|
||||||
"clean-test-scopes": "for f in test_scopes/*; do (cd $f; rm -rf bower_components); done",
|
|
||||||
"compile": "npm run-script -s check-env && grunt compile",
|
|
||||||
"build": "npm run-script -s check-env && grunt build",
|
|
||||||
"build-site": "npm run -s build-site-all-languages; npm run -s build-site-plato-report",
|
|
||||||
"build-site-all-languages": "./build_tools/generate_site.sh",
|
|
||||||
"build-site-by-language": "./build_tools/generate_site_by_language.sh",
|
|
||||||
"build-site-plato-report": "rm -rf ./site/plato && plato -d plato -l .jshintrc src/*.js src/**/*.js && mv plato site",
|
|
||||||
"upload-github-release": "node build_tools/upload-github-release.js",
|
|
||||||
"start-demo": "node build_tools/server.js"
|
|
||||||
},
|
|
||||||
"author": {
|
|
||||||
"name": "Pascal Precht"
|
|
||||||
},
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Jan Philipp",
|
|
||||||
"email": "knallisworld@googlemail.com",
|
|
||||||
"url": "https://github.com/knalli"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Max Prichinenko"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Thorsten S"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"devDependencies": {
|
|
||||||
"adm-zip": "^0.4.7",
|
|
||||||
"body-parser": "^1.16.0",
|
|
||||||
"bower": "^1.7.9",
|
|
||||||
"errorhandler": "^1.5.0",
|
|
||||||
"express": "^4.14.1",
|
|
||||||
"express-session": "^1.15.0",
|
|
||||||
"fbjs-scripts": "^0.7.1",
|
|
||||||
"grunt": "~1.0.1",
|
|
||||||
"grunt-bower-install-simple": "^1.0.3",
|
|
||||||
"grunt-bump": "^0.8.0",
|
|
||||||
"grunt-cli": "^1.2.0",
|
|
||||||
"grunt-contrib-clean": "^1.0.0",
|
|
||||||
"grunt-contrib-concat": "^1.0.0",
|
|
||||||
"grunt-contrib-copy": "^1.0.0",
|
|
||||||
"grunt-contrib-jshint": "^1.0.0",
|
|
||||||
"grunt-contrib-uglify": "^2.0.0",
|
|
||||||
"grunt-contrib-watch": "^1.0.0",
|
|
||||||
"grunt-conventional-changelog": "^6.1.0",
|
|
||||||
"grunt-file-append": "0.0.6",
|
|
||||||
"grunt-karma": "^2.0.0",
|
|
||||||
"grunt-ng-annotate": "^3.0.0",
|
|
||||||
"grunt-ngdocs": "~0.2.5",
|
|
||||||
"grunt-parallel": "^0.5.1",
|
|
||||||
"grunt-umd": "^2.3.3",
|
|
||||||
"grunt-version": "^1.0.0",
|
|
||||||
"inquirer": "^3.0.1",
|
|
||||||
"jasmine-core": "^2.1.3",
|
|
||||||
"karma": "^1.3.0",
|
|
||||||
"karma-chrome-launcher": "^2.0.0",
|
|
||||||
"karma-coverage": "^1.1.1",
|
|
||||||
"karma-firefox-launcher": "~1.0.0",
|
|
||||||
"karma-jasmine": "^1.0.2",
|
|
||||||
"karma-phantomjs-launcher": "^1.0.0",
|
|
||||||
"load-grunt-tasks": "^3.4.1",
|
|
||||||
"local-web-server": "^1.2.6",
|
|
||||||
"method-override": "^2.3.7",
|
|
||||||
"morgan": "^1.8.0",
|
|
||||||
"multer": "^1.3.0",
|
|
||||||
"phantomjs-prebuilt": "^2.1.4",
|
|
||||||
"plato": "^1.5.0",
|
|
||||||
"publish-release": "^1.3.3",
|
|
||||||
"pug": "^2.0.0-beta11",
|
|
||||||
"serve-favicon": "^2.3.2",
|
|
||||||
"tar.gz": "^1.0.5"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"angular": ">=1.2.26 <=1.6"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
# Logs
|
|
||||||
logs
|
|
||||||
*.log
|
|
||||||
npm-debug.log*
|
|
||||||
|
|
||||||
# Runtime data
|
|
||||||
pids
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
|
|
||||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
||||||
lib-cov
|
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
|
||||||
coverage
|
|
||||||
|
|
||||||
# nyc test coverage
|
|
||||||
.nyc_output
|
|
||||||
|
|
||||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
||||||
.grunt
|
|
||||||
|
|
||||||
# node-waf configuration
|
|
||||||
.lock-wscript
|
|
||||||
|
|
||||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
|
||||||
build/Release
|
|
||||||
|
|
||||||
# Dependency directories
|
|
||||||
node_modules
|
|
||||||
jspm_packages
|
|
||||||
|
|
||||||
# Optional npm cache directory
|
|
||||||
.npm
|
|
||||||
|
|
||||||
# Optional REPL history
|
|
||||||
.node_repl_history
|
|
||||||
.idea
|
|
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2016 it-ailen
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -1 +0,0 @@
|
||||||
# angular-treeview
|
|
|
@ -1,52 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by hyku on 16/9/29.
|
|
||||||
*/
|
|
||||||
var path = require("path");
|
|
||||||
var webpack = require("webpack");
|
|
||||||
|
|
||||||
var config = {
|
|
||||||
entry: {
|
|
||||||
tree: "./src/tree.js"
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
path: path.resolve(__dirname, ".."),
|
|
||||||
filename: "[name].js"
|
|
||||||
},
|
|
||||||
// resolve: {
|
|
||||||
// root: path.resolve(__dirname, "./src")
|
|
||||||
// },
|
|
||||||
module: {
|
|
||||||
loaders: [
|
|
||||||
{
|
|
||||||
test: /\.less$/i,
|
|
||||||
loaders: ["style", "css", "less"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.html$/i,
|
|
||||||
loaders: ["html"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.css$/i,
|
|
||||||
loaders: ["style", "css"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(jpe?g|png|gif|svg)$/i,
|
|
||||||
loader: "url-loader?limit=10000&name=images/[name].[ext]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(ttf|eot|woff2?)$/,
|
|
||||||
loader: 'file?name=etc/[name].[ext]'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.optimize.DedupePlugin(),
|
|
||||||
new webpack.ProvidePlugin({
|
|
||||||
$: "jquery",
|
|
||||||
jQuery: "jquery"
|
|
||||||
}),
|
|
||||||
new webpack.optimize.OccurenceOrderPlugin()
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = config;
|
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
|
@ -1,7 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by hyku on 2016/10/13.
|
|
||||||
*/
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
require("./tree");
|
|
||||||
module.exports = "angular.tree";
|
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-treeview",
|
|
||||||
"version": "0.1.5",
|
|
||||||
"description": "Treeview with angular.",
|
|
||||||
"main": "index.js",
|
|
||||||
"devDependencies": {
|
|
||||||
"css-loader": "^0.25.0",
|
|
||||||
"html-loader": "^0.4.4",
|
|
||||||
"less": "^2.7.1",
|
|
||||||
"less-loader": "^2.2.3",
|
|
||||||
"style-loader": "^0.13.1",
|
|
||||||
"url-loader": "^0.5.7",
|
|
||||||
"webpack": "^1.13.2"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "webpack --config build/webpack.config.base.js"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/it-ailen/angular-treeview.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"angular",
|
|
||||||
"treeview"
|
|
||||||
],
|
|
||||||
"author": "Allen Zou",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/it-ailen/angular-treeview/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/it-ailen/angular-treeview#readme"
|
|
||||||
}
|
|
|
@ -1,164 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by Allen Zou on 2016/10/13.
|
|
||||||
*/
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
require("./view/tree.less");
|
|
||||||
var fileIcon = require("./view/imgs/file.png");
|
|
||||||
var folderIcon = require("./view/imgs/folder.png");
|
|
||||||
var closedFolderIcon = require("./view/imgs/folder-closed.png");
|
|
||||||
var plusIcon = require("./view/imgs/plus.png");
|
|
||||||
var removeIcon = require("./view/imgs/remove.png");
|
|
||||||
|
|
||||||
var tree = angular.module("angular.tree", []);
|
|
||||||
tree
|
|
||||||
.directive("treeNode", function () {
|
|
||||||
return {
|
|
||||||
scope: {
|
|
||||||
item: "=",
|
|
||||||
adapter: "=",
|
|
||||||
icon: "=",
|
|
||||||
folderOpen: "=",
|
|
||||||
folderClose: "=",
|
|
||||||
nodeClick: "=",
|
|
||||||
childrenLoader: "=",
|
|
||||||
addItem: "=",
|
|
||||||
removeItem: "=",
|
|
||||||
editItem: "="
|
|
||||||
},
|
|
||||||
require: [],
|
|
||||||
restrict: "E",
|
|
||||||
// templateUrl: "directive/tree/node.html",
|
|
||||||
template: require("./view/node.html"),
|
|
||||||
link: function($scope, element, attributes, controllers) {
|
|
||||||
$scope.open = false;
|
|
||||||
$scope.add_btn = plusIcon;
|
|
||||||
$scope.remove_btn = removeIcon;
|
|
||||||
function load_children() {
|
|
||||||
if ($scope.childrenLoader) {
|
|
||||||
$scope.childrenLoader($scope.item)
|
|
||||||
.then(function(children) {
|
|
||||||
$scope.subNodes = children;
|
|
||||||
})
|
|
||||||
.catch(function(error) {
|
|
||||||
console.error(error);
|
|
||||||
$scope.subNodes = [];
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
$scope.subNodes = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$scope.wrap_node_click = function() {
|
|
||||||
if ($scope.item) {
|
|
||||||
var adaptedItem = $scope.adapter($scope.item);
|
|
||||||
if (adaptedItem.type === "branch") {
|
|
||||||
if ($scope.open) {
|
|
||||||
$scope.open = false;
|
|
||||||
$scope.folderClose && $scope.folderClose($scope.item);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$scope.open = true;
|
|
||||||
$scope.folderOpen && $scope.folderOpen($scope.item);
|
|
||||||
load_children();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$scope.nodeClick && $scope.nodeClick($scope.item);
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
$scope.resolve_icon = function() {
|
|
||||||
var icon = null;
|
|
||||||
var adaptedItem = $scope.adapter($scope.item);
|
|
||||||
if (adaptedItem.type === 'branch') {
|
|
||||||
icon = ($scope.icon && $scope.icon($scope.item, $scope.open))
|
|
||||||
|| (!$scope.open && closedFolderIcon)
|
|
||||||
|| ($scope.open && folderIcon);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
icon = ($scope.icon && $scope.icon($scope.item))
|
|
||||||
|| fileIcon;
|
|
||||||
}
|
|
||||||
return icon;
|
|
||||||
};
|
|
||||||
$scope.node_class = function() {
|
|
||||||
var classes = ["node"];
|
|
||||||
var adaptedItem = $scope.adapter($scope.item);
|
|
||||||
if (adaptedItem.type === 'branch') {
|
|
||||||
classes.push("branch");
|
|
||||||
if ($scope.open) {
|
|
||||||
classes.push("open");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
classes.push("closed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
classes.push("leaf");
|
|
||||||
}
|
|
||||||
return classes;
|
|
||||||
};
|
|
||||||
$scope.add_child = function() {
|
|
||||||
if ($scope.addItem) {
|
|
||||||
$scope.addItem($scope.item)
|
|
||||||
.then(function() {
|
|
||||||
load_children();
|
|
||||||
})
|
|
||||||
;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
$scope.remove_self = function() {
|
|
||||||
if ($scope.removeItem) {
|
|
||||||
$scope.removeItem($scope.item)
|
|
||||||
.then(function() {
|
|
||||||
load_children();
|
|
||||||
})
|
|
||||||
;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
$scope.edit = function() {
|
|
||||||
console.log("edit:::");
|
|
||||||
console.log($scope.editItem);
|
|
||||||
$scope.editItem && $scope.editItem($scope.item);
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.directive("tree", function () {
|
|
||||||
var link = function($scope, element, attributes, controllers) {
|
|
||||||
$scope.itemAdapter = $scope.adapter || function(item) {
|
|
||||||
console.log("in tree .adapter");
|
|
||||||
return item;
|
|
||||||
};
|
|
||||||
$scope.tree_class = function() {
|
|
||||||
var classes = ["tree"];
|
|
||||||
return classes;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
scope: {
|
|
||||||
root: "=root",
|
|
||||||
adapter: "=",
|
|
||||||
icon: "=",
|
|
||||||
folderOpen: "=",
|
|
||||||
folderClose: "=",
|
|
||||||
nodeClick: "=",
|
|
||||||
childrenLoader: "=",
|
|
||||||
addItem: "=",
|
|
||||||
removeItem: "=",
|
|
||||||
editItem: "="
|
|
||||||
},
|
|
||||||
require: [],
|
|
||||||
restrict: "E",
|
|
||||||
// templateUrl: "directive/tree/tree.html",
|
|
||||||
template: require("./view/tree.html"),
|
|
||||||
link: link
|
|
||||||
}
|
|
||||||
})
|
|
||||||
;
|
|
||||||
|
|
||||||
module.exports = tree;
|
|
Binary file not shown.
Before Width: | Height: | Size: 263 B |
Binary file not shown.
Before Width: | Height: | Size: 281 B |
Binary file not shown.
Before Width: | Height: | Size: 289 B |
Binary file not shown.
Before Width: | Height: | Size: 7.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.9 KiB |
|
@ -1,24 +0,0 @@
|
||||||
<div ng-class="node_class()">
|
|
||||||
<div class="directory-level" ng-click="wrap_node_click()">
|
|
||||||
<img class="icon" ng-src="{{ resolve_icon() }}">
|
|
||||||
<span>{{ adapter(item).text }}</span>
|
|
||||||
<div class="operation" ng-click="$event.stopPropagation()">
|
|
||||||
<a href class="add" ng-click="add_child()" ng-if="adapter(item).type==='branch'">
|
|
||||||
<img ng-src="{{ add_btn }}">
|
|
||||||
</a>
|
|
||||||
<a href class="remove" ng-click="remove_self()">
|
|
||||||
<img ng-src="{{ remove_btn }}">
|
|
||||||
</a>
|
|
||||||
<a href class="edit" ng-click="edit()">
|
|
||||||
<span class="glyphicon glyphicon-edit"></span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sub-node" ng-if="open" ng-repeat="node in subNodes">
|
|
||||||
<tree-node item="node" adapter="adapter" icon="icon"
|
|
||||||
folder-open="folderOpen" folder-close="folderClose"
|
|
||||||
node-click="nodeClick" children-loader="childrenLoader"
|
|
||||||
add-item="addItem" remove-item="removeItem" edit-item="editItem">
|
|
||||||
</tree-node>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<div ng-class="tree_class()">
|
|
||||||
<tree-node item="root" adapter="itemAdapter" icon="icon"
|
|
||||||
folder-open="folderOpen" folder-close="folderClose"
|
|
||||||
node-click="nodeClick" children-loader="childrenLoader"
|
|
||||||
add-item="addItem" remove-item="removeItem" edit-item="editItem">
|
|
||||||
</tree-node>
|
|
||||||
</div>
|
|
|
@ -1,33 +0,0 @@
|
||||||
.tree {
|
|
||||||
@node-height: 16px;
|
|
||||||
overflow: auto;
|
|
||||||
.node {
|
|
||||||
width: 100%;
|
|
||||||
.directory-level {
|
|
||||||
position: relative;
|
|
||||||
padding-right: 4px;
|
|
||||||
white-space: nowrap;
|
|
||||||
font-size: @node-height;
|
|
||||||
line-height: @node-height;
|
|
||||||
>.icon {
|
|
||||||
height: @node-height;
|
|
||||||
}
|
|
||||||
.operation {
|
|
||||||
display: inline;
|
|
||||||
margin-left: 20px;
|
|
||||||
visibility: hidden;
|
|
||||||
img {
|
|
||||||
height: @node-height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&:hover {
|
|
||||||
.operation {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.sub-node {
|
|
||||||
padding-left: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because one or more lines are too long
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"directory": "bower_components"
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"curly": true,
|
|
||||||
"eqeqeq": true,
|
|
||||||
"immed": true,
|
|
||||||
"latedef": true,
|
|
||||||
"newcap": true,
|
|
||||||
"noarg": true,
|
|
||||||
"sub": true,
|
|
||||||
"boss": true,
|
|
||||||
"eqnull": true
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
node_modules
|
|
||||||
bower_components
|
|
||||||
demo/bower_components
|
|
|
@ -1,13 +0,0 @@
|
||||||
language: node_js
|
|
||||||
node_js:
|
|
||||||
- "0.8"
|
|
||||||
- "0.10"
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- export DISPLAY=:99.0
|
|
||||||
- sh -e /etc/init.d/xvfb start
|
|
||||||
- npm install -g karma bower grunt-cli
|
|
||||||
- bower install
|
|
||||||
- npm install
|
|
||||||
|
|
||||||
script: "grunt"
|
|
|
@ -1,8 +0,0 @@
|
||||||
CONTRIBUTING
|
|
||||||
============
|
|
||||||
|
|
||||||
* Open a [Pull Request (PR)](https://github.com/angular-ui/ui-select2/pull/new/master)
|
|
||||||
* Make sure your PR is on a **new branch** you created off of the latest version of master
|
|
||||||
* Do **not** open a PR from your master branch
|
|
||||||
* Open a PR to start a discussion even if the code isn't finished (easier to collect feedback this way)
|
|
||||||
* Make sure all previous tests pass and add new tests for added behaviors
|
|
|
@ -1,59 +0,0 @@
|
||||||
module.exports = function (grunt) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var initConfig;
|
|
||||||
|
|
||||||
// Loading external tasks
|
|
||||||
require('load-grunt-tasks')(grunt);
|
|
||||||
|
|
||||||
// Project configuration.
|
|
||||||
initConfig = {
|
|
||||||
bower: 'bower_components',
|
|
||||||
pkg: grunt.file.readJSON('package.json'),
|
|
||||||
watch: {
|
|
||||||
test: {
|
|
||||||
// Lint & run unit tests in Karma
|
|
||||||
// Just running `$ grunt watch` will only lint your code; to run tests
|
|
||||||
// on watch, use `$ grunt watch:karma` to start a Karma server first
|
|
||||||
files: ['src/select2.js', 'test/select2Spec.js'],
|
|
||||||
tasks: ['jshint', 'karma:unit:run']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
karma: {
|
|
||||||
options: {
|
|
||||||
configFile: 'test/karma.conf.js',
|
|
||||||
browsers: ['Firefox', 'PhantomJS']
|
|
||||||
},
|
|
||||||
unit: {
|
|
||||||
singleRun: true
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
autoWatch: true
|
|
||||||
},
|
|
||||||
server: {
|
|
||||||
background: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
jshint: {
|
|
||||||
all:[
|
|
||||||
'gruntFile.js',
|
|
||||||
'src/**/*.js',
|
|
||||||
'test/**/*Spec.js'
|
|
||||||
],
|
|
||||||
options: {
|
|
||||||
jshintrc: '.jshintrc'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
changelog: {
|
|
||||||
options: {
|
|
||||||
dest: 'CHANGELOG.md'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Register tasks
|
|
||||||
grunt.registerTask('default', ['jshint', 'karma:unit']);
|
|
||||||
grunt.registerTask('watch', ['jshint', 'karma:watch']);
|
|
||||||
|
|
||||||
grunt.initConfig(initConfig);
|
|
||||||
};
|
|
|
@ -1,21 +0,0 @@
|
||||||
The MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2012 the AngularUI Team, http://angular-ui.github.com
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
|
@ -1,173 +0,0 @@
|
||||||
ui-select2 [![Build Status](https://travis-ci.org/angular-ui/ui-select2.png)](https://travis-ci.org/angular-ui/ui-select2)
|
|
||||||
==========
|
|
||||||
This directive allows you to enhance your select elements with behaviour from the [select2](http://ivaynberg.github.io/select2/) library.
|
|
||||||
|
|
||||||
# Requirements
|
|
||||||
|
|
||||||
- [AngularJS](http://angularjs.org/)
|
|
||||||
- [JQuery](http://jquery.com/)
|
|
||||||
- [Select2](http://ivaynberg.github.io/select2/)
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
1. Install **Karma**, **Grunt** and **Bower**
|
|
||||||
`$ npm install -g karma grunt-cli bower`
|
|
||||||
2. Install development dependencies
|
|
||||||
`$ npm install`
|
|
||||||
3. Install components
|
|
||||||
`$ bower install`
|
|
||||||
4. ???
|
|
||||||
5. Profit!
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
We use [Grunt](http://gruntjs.com/) to check for JavaScript syntax errors and execute all unit tests. To run Grunt, simply execute:
|
|
||||||
|
|
||||||
`$ grunt`
|
|
||||||
|
|
||||||
This will lint and test the code, then exit. To have Grunt stay open and automatically lint and test your files whenever you make a code change, use:
|
|
||||||
|
|
||||||
`$ grunt karma:server watch`
|
|
||||||
|
|
||||||
This will start a Karma server in the background and run unit tests in Firefox and PhantomJS whenever the source code or spec file is saved.
|
|
||||||
|
|
||||||
# Usage
|
|
||||||
|
|
||||||
We use [bower](https://github.com/bower/bower) for dependency management. Install AngularUI Select2 into your project by running the command
|
|
||||||
|
|
||||||
`$ bower install angular-ui-select2`
|
|
||||||
|
|
||||||
If you use a `bower.json` file in your project, you can have Bower save ui-select2 as a dependency by passing the `--save` or `--save-dev` flag with the above command.
|
|
||||||
|
|
||||||
This will copy the ui-select2 files into your `bower_components` folder, along with its dependencies. Load the script files in your application:
|
|
||||||
```html
|
|
||||||
<link rel="stylesheet" href="bower_components/select2/select2.css">
|
|
||||||
<script type="text/javascript" src="bower_components/jquery/jquery.js"></script>
|
|
||||||
<script type="text/javascript" src="bower_components/select2/select2.js"></script>
|
|
||||||
<script type="text/javascript" src="bower_components/angular/angular.js"></script>
|
|
||||||
<script type="text/javascript" src="bower_components/angular-ui-select2/src/select2.js"></script>
|
|
||||||
```
|
|
||||||
|
|
||||||
(Note that `jquery` must be loaded before `angular` so that it doesn't use `jqLite` internally)
|
|
||||||
|
|
||||||
|
|
||||||
Add the select2 module as a dependency to your application module:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var myAppModule = angular.module('MyApp', ['ui.select2']);
|
|
||||||
```
|
|
||||||
|
|
||||||
Apply the directive to your form elements:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<select ui-select2 ng-model="select2" data-placeholder="Pick a number">
|
|
||||||
<option value=""></option>
|
|
||||||
<option value="one">First</option>
|
|
||||||
<option value="two">Second</option>
|
|
||||||
<option value="three">Third</option>
|
|
||||||
</select>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Options
|
|
||||||
|
|
||||||
All the select2 options can be passed through the directive. You can read more about the supported list of options and what they do on the [Select2 Documentation Page](http://ivaynberg.github.com/select2/)
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
myAppModule.controller('MyController', function($scope) {
|
|
||||||
$scope.select2Options = {
|
|
||||||
allowClear:true
|
|
||||||
};
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
```html
|
|
||||||
<select ui-select2="select2Options" ng-model="select2">
|
|
||||||
<option value="one">First</option>
|
|
||||||
<option value="two">Second</option>
|
|
||||||
<option value="three">Third</option>
|
|
||||||
</select>
|
|
||||||
```
|
|
||||||
|
|
||||||
Some times it may make sense to specify the options in the template file.
|
|
||||||
|
|
||||||
```html
|
|
||||||
<select ui-select2="{ allowClear: true}" ng-model="select2">
|
|
||||||
<option value="one">First</option>
|
|
||||||
<option value="two">Second</option>
|
|
||||||
<option value="three">Third</option>
|
|
||||||
</select>
|
|
||||||
```
|
|
||||||
|
|
||||||
To define global defaults, you can configure the `uiSelect2Config` injectable:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
myAppModule.run(['uiSelect2Config', function(uiSelect2Config) {
|
|
||||||
uiSelect2Config.placeholder = "Placeholder text";
|
|
||||||
}]);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Working with ng-model
|
|
||||||
|
|
||||||
The ui-select2 directive plays nicely with ng-model and validation directives such as ng-required.
|
|
||||||
|
|
||||||
If you add the ng-model directive to same the element as ui-select2 then the picked option is automatically synchronized with the model value.
|
|
||||||
|
|
||||||
## Working with dynamic options
|
|
||||||
`ui-select2` is incompatible with `<select ng-options>`. For the best results use `<option ng-repeat>` instead.
|
|
||||||
```html
|
|
||||||
<select ui-select2 ng-model="select2" data-placeholder="Pick a number">
|
|
||||||
<option value=""></option>
|
|
||||||
<option ng-repeat="number in range" value="{{number.value}}">{{number.text}}</option>
|
|
||||||
</select>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Working with placeholder text
|
|
||||||
In order to properly support the Select2 placeholder, create an empty `<option>` tag at the top of the `<select>` and either set a `data-placeholder` on the select element or pass a `placeholder` option to Select2.
|
|
||||||
```html
|
|
||||||
<select ui-select2 ng-model="number" data-placeholder="Pick a number">
|
|
||||||
<option value=""></option>
|
|
||||||
<option value="one">First</option>
|
|
||||||
<option value="two">Second</option>
|
|
||||||
<option value="three">Third</option>
|
|
||||||
</select>
|
|
||||||
```
|
|
||||||
|
|
||||||
## ng-required directive
|
|
||||||
|
|
||||||
If you apply the required directive to element then the form element is invalid until an option is selected.
|
|
||||||
|
|
||||||
Note: Remember that the ng-required directive must be explicitly set, i.e. to "true". This is especially true on divs:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<select ui-select2 ng-model="number" data-placeholder="Pick a number" ng-required="true">
|
|
||||||
<option value=""></option>
|
|
||||||
<option value="one">First</option>
|
|
||||||
<option value="two">Second</option>
|
|
||||||
<option value="three">Third</option>
|
|
||||||
</select>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Using simple tagging mode
|
|
||||||
|
|
||||||
When AngularJS View-Model tags are stored as a list of strings, setting
|
|
||||||
the ui-select2 specific option `simple_tags` will allow to keep the model
|
|
||||||
as a list of strings, and not convert it into a list of Select2 tag objects.
|
|
||||||
|
|
||||||
```html
|
|
||||||
<input
|
|
||||||
type="hidden"
|
|
||||||
ui-select2="select2Options"
|
|
||||||
ng-model="list_of_string"
|
|
||||||
>
|
|
||||||
```
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
myAppModule.controller('MyController', function($scope) {
|
|
||||||
$scope.list_of_string = ['tag1', 'tag2']
|
|
||||||
$scope.select2Options = {
|
|
||||||
'multiple': true,
|
|
||||||
'simple_tags': true,
|
|
||||||
'tags': ['tag1', 'tag2', 'tag3', 'tag4'] // Can be empty list.
|
|
||||||
};
|
|
||||||
});
|
|
||||||
```
|
|
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"author": "AngularUI",
|
|
||||||
"name": "angular-ui-select2",
|
|
||||||
"version": "0.0.5",
|
|
||||||
"homepage": "http://angular-ui.github.com",
|
|
||||||
"keywords": [
|
|
||||||
"angular",
|
|
||||||
"angularui",
|
|
||||||
"select2"
|
|
||||||
],
|
|
||||||
"main": "./src/select2.js",
|
|
||||||
"dependencies": {
|
|
||||||
"angular": ">=1.2.0",
|
|
||||||
"select2": "~3.4",
|
|
||||||
"jquery": ">=1.6.4"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"angular-mocks": ">=1.0.2"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,114 +0,0 @@
|
||||||
|
|
||||||
var app = angular.module('angular-ui-select2-demo', ['ui.select2']);
|
|
||||||
|
|
||||||
app.controller('MainCtrl', function ($scope, $element) {
|
|
||||||
|
|
||||||
var states = [
|
|
||||||
{ text: 'Alaskan/Hawaiian Time Zone', children: [
|
|
||||||
{ id: 'AK', text: 'Alaska' },
|
|
||||||
{ id: 'HI', text: 'Hawaii' }
|
|
||||||
]},
|
|
||||||
{ text: 'Pacific Time Zone', children: [
|
|
||||||
{ id: 'CA', text: 'California' },
|
|
||||||
{ id: 'NV', text: 'Nevada' },
|
|
||||||
{ id: 'OR', text: 'Oregon' },
|
|
||||||
{ id: 'WA', text: 'Washington' }
|
|
||||||
]},
|
|
||||||
{ text: 'Mountain Time Zone', children: [
|
|
||||||
{ id: 'AZ', text: 'Arizona' },
|
|
||||||
{ id: 'CO', text: 'Colorado' },
|
|
||||||
{ id: 'ID', text: 'Idaho' },
|
|
||||||
{ id: 'MT', text: 'Montana' },
|
|
||||||
{ id: 'NE', text: 'Nebraska' },
|
|
||||||
{ id: 'NM', text: 'New Mexico' },
|
|
||||||
{ id: 'ND', text: 'North Dakota' },
|
|
||||||
{ id: 'UT', text: 'Utah' },
|
|
||||||
{ id: 'WY', text: 'Wyoming' }
|
|
||||||
]},
|
|
||||||
{ text: 'Central Time Zone', children: [
|
|
||||||
{ id: 'AL', text: 'Alabama' },
|
|
||||||
{ id: 'AR', text: 'Arkansas' },
|
|
||||||
{ id: 'IL', text: 'Illinois' },
|
|
||||||
{ id: 'IA', text: 'Iowa' },
|
|
||||||
{ id: 'KS', text: 'Kansas' },
|
|
||||||
{ id: 'KY', text: 'Kentucky' },
|
|
||||||
{ id: 'LA', text: 'Louisiana' },
|
|
||||||
{ id: 'MN', text: 'Minnesota' },
|
|
||||||
{ id: 'MS', text: 'Mississippi' },
|
|
||||||
{ id: 'MO', text: 'Missouri' },
|
|
||||||
{ id: 'OK', text: 'Oklahoma' },
|
|
||||||
{ id: 'SD', text: 'South Dakota' },
|
|
||||||
{ id: 'TX', text: 'Texas' },
|
|
||||||
{ id: 'TN', text: 'Tennessee' },
|
|
||||||
{ id: 'WI', text: 'Wisconsin' }
|
|
||||||
]},
|
|
||||||
{ text: 'Eastern Time Zone', children: [
|
|
||||||
{ id: 'CT', text: 'Connecticut' },
|
|
||||||
{ id: 'DE', text: 'Delaware' },
|
|
||||||
{ id: 'FL', text: 'Florida' },
|
|
||||||
{ id: 'GA', text: 'Georgia' },
|
|
||||||
{ id: 'IN', text: 'Indiana' },
|
|
||||||
{ id: 'ME', text: 'Maine' },
|
|
||||||
{ id: 'MD', text: 'Maryland' },
|
|
||||||
{ id: 'MA', text: 'Massachusetts' },
|
|
||||||
{ id: 'MI', text: 'Michigan' },
|
|
||||||
{ id: 'NH', text: 'New Hampshire' },
|
|
||||||
{ id: 'NJ', text: 'New Jersey' },
|
|
||||||
{ id: 'NY', text: 'New York' },
|
|
||||||
{ id: 'NC', text: 'North Carolina' },
|
|
||||||
{ id: 'OH', text: 'Ohio' },
|
|
||||||
{ id: 'PA', text: 'Pennsylvania' },
|
|
||||||
{ id: 'RI', text: 'Rhode Island' },
|
|
||||||
{ id: 'SC', text: 'South Carolina' },
|
|
||||||
{ id: 'VT', text: 'Vermont' },
|
|
||||||
{ id: 'VA', text: 'Virginia' },
|
|
||||||
{ id: 'WV', text: 'West Virginia' }
|
|
||||||
]}
|
|
||||||
];
|
|
||||||
|
|
||||||
function findState(id) {
|
|
||||||
for (var i=0; i<states.length; i++) {
|
|
||||||
for (var j=0; j<states[i].children.length; j++) {
|
|
||||||
if (states[i].children[j].id == id) {
|
|
||||||
return states[i].children[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.multi2Value = ['CO', 'WA'];
|
|
||||||
|
|
||||||
$scope.multi = {
|
|
||||||
multiple: true,
|
|
||||||
query: function (query) {
|
|
||||||
query.callback({ results: states });
|
|
||||||
},
|
|
||||||
initSelection: function(element, callback) {
|
|
||||||
var val = $(element).select2('val'),
|
|
||||||
results = [];
|
|
||||||
for (var i=0; i<val.length; i++) {
|
|
||||||
results.push(findState(val[i]));
|
|
||||||
}
|
|
||||||
callback(results);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.placeholders = {
|
|
||||||
placeholder: "Select a State"
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.array = {
|
|
||||||
data: [{id:0,text:'enhancement'},{id:1,text:'bug'},{id:2,text:'duplicate'},{id:3,text:'invalid'},{id:4,text:'wontfix'}]
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.arrayAsync = {
|
|
||||||
query: function (query) {
|
|
||||||
query.callback({ results: states });
|
|
||||||
},
|
|
||||||
initSelection: function(element, callback) {
|
|
||||||
var val = $(element).select2('val');
|
|
||||||
return callback(findState(val));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"name": "angular-ui-select2-demo",
|
|
||||||
"main": "./index.html",
|
|
||||||
"dependencies": {
|
|
||||||
"angular": ">=1.2.0",
|
|
||||||
"select2": "~3.4",
|
|
||||||
"jquery": ">=1.6.4",
|
|
||||||
"bootstrap": "~3.0.3",
|
|
||||||
"angular-ui-select2": "~0.0.5"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,225 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html ng-app="angular-ui-select2-demo">
|
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
|
|
||||||
<link rel="stylesheet" href="bower_components/select2/select2.css">
|
|
||||||
<style>
|
|
||||||
.container {
|
|
||||||
padding-bottom: 4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
margin-top: 2em;
|
|
||||||
}
|
|
||||||
h3 {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: normal;
|
|
||||||
margin-top: 0.2em;
|
|
||||||
}
|
|
||||||
.select2-container {
|
|
||||||
}
|
|
||||||
label {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: normal;
|
|
||||||
display: block;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
.example.row {
|
|
||||||
margin-top: 1em;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script src="bower_components/jquery/dist/jquery.js"></script>
|
|
||||||
<script src="bower_components/select2/select2.js"></script>
|
|
||||||
<script src="bower_components/angular/angular.js"></script>
|
|
||||||
<script src="bower_components/angular-ui-select2/src/select2.js"></script>
|
|
||||||
<script src="app.js"></script>
|
|
||||||
<script>
|
|
||||||
$(function() {
|
|
||||||
var opts=$('#source').html(), opts2='<option></option>'+opts;
|
|
||||||
$('select.populate').each(function() { var e=$(this); e.html(e.hasClass('placeholder')?opts2:opts); });
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container" ng-controller="MainCtrl">
|
|
||||||
|
|
||||||
<article class="row" id="basics">
|
|
||||||
<h2>The Basics</h2>
|
|
||||||
<div class="example row">
|
|
||||||
<div class="col-md-4 left">
|
|
||||||
<label><select></label>
|
|
||||||
<select style="width:300px" ui-select2 ng-model="basicsValue" id="source">
|
|
||||||
<optgroup label="Alaskan/Hawaiian Time Zone">
|
|
||||||
<option value="AK">Alaska</option>
|
|
||||||
<option value="HI">Hawaii</option>
|
|
||||||
</optgroup>
|
|
||||||
<optgroup label="Pacific Time Zone">
|
|
||||||
<option value="CA">California</option>
|
|
||||||
<option value="NV">Nevada</option>
|
|
||||||
<option value="OR">Oregon</option>
|
|
||||||
<option value="WA">Washington</option>
|
|
||||||
</optgroup>
|
|
||||||
<optgroup label="Mountain Time Zone">
|
|
||||||
<option value="AZ">Arizona</option>
|
|
||||||
<option value="CO">Colorado</option>
|
|
||||||
<option value="ID">Idaho</option>
|
|
||||||
<option value="MT">Montana</option>
|
|
||||||
<option value="NE">Nebraska</option>
|
|
||||||
<option value="NM">New Mexico</option>
|
|
||||||
<option value="ND">North Dakota</option>
|
|
||||||
<option value="UT">Utah</option>
|
|
||||||
<option value="WY">Wyoming</option>
|
|
||||||
</optgroup>
|
|
||||||
<optgroup label="Central Time Zone">
|
|
||||||
<option value="AL">Alabama</option>
|
|
||||||
<option value="AR">Arkansas</option>
|
|
||||||
<option value="IL">Illinois</option>
|
|
||||||
<option value="IA">Iowa</option>
|
|
||||||
<option value="KS">Kansas</option>
|
|
||||||
<option value="KY">Kentucky</option>
|
|
||||||
<option value="LA">Louisiana</option>
|
|
||||||
<option value="MN">Minnesota</option>
|
|
||||||
<option value="MS">Mississippi</option>
|
|
||||||
<option value="MO">Missouri</option>
|
|
||||||
<option value="OK">Oklahoma</option>
|
|
||||||
<option value="SD">South Dakota</option>
|
|
||||||
<option value="TX">Texas</option>
|
|
||||||
<option value="TN">Tennessee</option>
|
|
||||||
<option value="WI">Wisconsin</option>
|
|
||||||
</optgroup>
|
|
||||||
<optgroup label="Eastern Time Zone">
|
|
||||||
<option value="CT">Connecticut</option>
|
|
||||||
<option value="DE">Delaware</option>
|
|
||||||
<option value="FL">Florida</option>
|
|
||||||
<option value="GA">Georgia</option>
|
|
||||||
<option value="IN">Indiana</option>
|
|
||||||
<option value="ME">Maine</option>
|
|
||||||
<option value="MD">Maryland</option>
|
|
||||||
<option value="MA">Massachusetts</option>
|
|
||||||
<option value="MI">Michigan</option>
|
|
||||||
<option value="NH">New Hampshire</option>
|
|
||||||
<option value="NJ">New Jersey</option>
|
|
||||||
<option value="NY">New York</option>
|
|
||||||
<option value="NC">North Carolina</option>
|
|
||||||
<option value="OH">Ohio</option>
|
|
||||||
<option value="PA">Pennsylvania</option>
|
|
||||||
<option value="RI">Rhode Island</option>
|
|
||||||
<option value="SC">South Carolina</option>
|
|
||||||
<option value="VT">Vermont</option>
|
|
||||||
<option value="VA">Virginia</option>
|
|
||||||
<option value="WV">West Virginia</option>
|
|
||||||
</optgroup>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8 right">
|
|
||||||
<h3>Value</h3>
|
|
||||||
<pre>{{ basicsValue }}</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article class="row" id="multi">
|
|
||||||
<h2>Multi-Value</h2>
|
|
||||||
<div class="example row">
|
|
||||||
<div class="col-md-4 left">
|
|
||||||
<label><select multiple></label>
|
|
||||||
<select style="width:300px" ui-select2 multiple ng-model="multiValue" class="populate"></select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8 right">
|
|
||||||
<h3>Value</h3>
|
|
||||||
<pre>{{ multiValue }}</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="example row">
|
|
||||||
<div class="col-md-4 left">
|
|
||||||
<label>Pre-defined value</label>
|
|
||||||
<input type="hidden" style="width:300px" ui-select2="multi" ng-model="multi2Value"/>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8 right">
|
|
||||||
<h3>Config</h3>
|
|
||||||
<pre><code>{
|
|
||||||
multiple: true,
|
|
||||||
query: function (query) {
|
|
||||||
query.callback({ results: states });
|
|
||||||
},
|
|
||||||
initSelection: function(element, callback) {
|
|
||||||
var val = $(element).select2('val'),
|
|
||||||
results = [];
|
|
||||||
for (var i=0; i<val.length; i++) {
|
|
||||||
results.push(findState(val[i]));
|
|
||||||
}
|
|
||||||
callback(results);
|
|
||||||
}
|
|
||||||
}</code></pre>
|
|
||||||
<h3>Value</h3>
|
|
||||||
<pre>{{ multi2Value }}</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article class="row" id="placeholders">
|
|
||||||
<h2>Placeholders</h2>
|
|
||||||
<div class="example row">
|
|
||||||
<div class="col-md-4 left">
|
|
||||||
<label>Using data-attribute</label>
|
|
||||||
<select style="width:300px" ui-select2 ng-model="placeholdersValue" class="populate placeholder" data-placeholder="Select a State"></select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8 right">
|
|
||||||
<h3>Value</h3>
|
|
||||||
<pre>{{ placeholdersValue }}</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="example row">
|
|
||||||
<div class="col-md-4 left">
|
|
||||||
<label>Multiple, using config</label>
|
|
||||||
<select style="width:300px" ui-select2="placeholders" multiple ng-model="placeholdersMultiValue" class="populate"></select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8 right">
|
|
||||||
<h3>Config</h3>
|
|
||||||
<pre><code>{{ placeholders }}</code></pre>
|
|
||||||
<h3>Value</h3>
|
|
||||||
<pre>{{ placeholdersMultiValue }}</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article class="row" id="array">
|
|
||||||
<h2>Array Data</h2>
|
|
||||||
<div class="example row">
|
|
||||||
<div class="col-md-4 left">
|
|
||||||
<label>Simple</label>
|
|
||||||
<input type="hidden" style="width:300px" ui-select2="array" ng-model="arrayValue"/>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8 right">
|
|
||||||
<h3>Config</h3>
|
|
||||||
<pre><code>{{ array }}</code></pre>
|
|
||||||
<h3>Value</h3>
|
|
||||||
<pre>{{ arrayValue }}</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="example row">
|
|
||||||
<div class="col-md-4 left">
|
|
||||||
<label>Asynchronous</label>
|
|
||||||
<input type="hidden" style="width:300px" ui-select2="arrayAsync" ng-model="arrayAsyncValue"/>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8 right">
|
|
||||||
<h3>Config</h3>
|
|
||||||
<pre><code>{
|
|
||||||
query: function (query) {
|
|
||||||
query.callback({ results: states });
|
|
||||||
},
|
|
||||||
initSelection: function(element, callback) {
|
|
||||||
var val = $(element).select2('val');
|
|
||||||
return callback(findState(val));
|
|
||||||
}
|
|
||||||
}</code></pre>
|
|
||||||
<h3>Value</h3>
|
|
||||||
<pre>{{ arrayAsyncValue }}</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,47 +0,0 @@
|
||||||
<section id="directives-select2">
|
|
||||||
<div class="page-header">
|
|
||||||
<h1>Select2</h1>
|
|
||||||
<small><a href="http://ivaynberg.github.com/select2/">Select2</a> is inspired by <a href="http://harvesthq.github.com/chosen">Chosen</a></small>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="span6">
|
|
||||||
<h3>Demo</h3>
|
|
||||||
<div class="well">
|
|
||||||
<p>Value is: {{select2}} <a ng-click="select2='two'">(choose second)</a></p>
|
|
||||||
<select ui-select2 ng-model="select2" data-placeholder="Pick a number">
|
|
||||||
<option value=""></option>
|
|
||||||
<option value="one">First</option>
|
|
||||||
<option value="two">Second</option>
|
|
||||||
<option value="three">Third</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="well">
|
|
||||||
<p>Value is: {{select2multiple}} <a ng-click="select2multiple=['two']">(choose second)</a></p>
|
|
||||||
<select ui-select2 ng-model="select2multiple" data-placeholder="Pick a number" multiple>
|
|
||||||
<option value="one">First</option>
|
|
||||||
<option value="two">Second</option>
|
|
||||||
<option value="three">Third</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="span6">
|
|
||||||
<h3>Options</h3>
|
|
||||||
<p>You can pass an object to Select2 as the expression: <code>ui-select2="{allowClear:true}"</code> that will be passed directly to <code>$.fn.select2()</code>. You can read more about the supported list of options and what they do on the <a href="http://ivaynberg.github.com/select2/">Select2 Documentation Page</a>. AngularUI will leverage properties passed to Select2 for any complex behavior, there are no parameters necessary for that are specific to AngularUI.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p class="alert alert-info"><i class="icon-info-sign"></i> <code>ui-select2</code> is incompatible with <code><select ng-options></code>. For the best results use <code><option ng-repeat></code> instead</p>
|
|
||||||
<p class="alert alert-info"><i class="icon-info-sign"></i> In order to properly support the Select2 placeholder, create an empty <code><option></code> tag at the top of the <code><select></code> and either set a <code>data-placeholder</code> on the select element or pass a <code>placeholder</code> option to Select2.</p>
|
|
||||||
|
|
||||||
<h3>How?</h3>
|
|
||||||
<pre class="prettyprint linenums" ng-non-bindable>
|
|
||||||
<p>Value is: {{select2}} <a ng-click="select2='two'">(choose second)</a></p>
|
|
||||||
<select ui-select2 ng-model="select2">
|
|
||||||
<option value="">Pick a number</option>
|
|
||||||
<option value="one">First</option>
|
|
||||||
<option value="two">Second</option>
|
|
||||||
<option value="three">Third</option>
|
|
||||||
</select>
|
|
||||||
</pre>
|
|
||||||
<p>Or try playing around with this <a href="http://plnkr.co/edit/gist:4279651?p=preview">sandbox demo</a> to see how AJAX works</p>
|
|
||||||
</section>
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue