sunspot_solr 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/sunspot-solr +2 -6
- data/lib/sunspot/solr/server.rb +2 -3
- data/solr/README.txt +181 -181
- data/solr/bin/post +29 -19
- data/solr/bin/solr +247 -428
- data/solr/bin/solr.cmd +102 -256
- data/solr/bin/solr.in.cmd +15 -7
- data/solr/bin/solr.in.sh +26 -12
- data/solr/server/README.txt +110 -113
- data/solr/server/contexts/solr-jetty-context.xml +8 -8
- data/solr/server/etc/jetty-http.xml +47 -0
- data/solr/server/etc/jetty-https-ssl.xml +175 -159
- data/solr/server/etc/jetty-https.xml +53 -0
- data/solr/server/etc/jetty-ssl.xml +46 -0
- data/solr/server/etc/jetty.xml +189 -167
- data/solr/server/etc/webdefault.xml +527 -527
- data/solr/server/lib/javax.servlet-api-3.1.0.jar +0 -0
- data/solr/server/lib/jetty-continuation-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-deploy-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-http-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-io-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-jmx-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-rewrite-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-security-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-server-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-servlet-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-servlets-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-util-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-webapp-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-xml-9.2.11.v20150529.jar +0 -0
- data/solr/server/modules/http.mod +9 -0
- data/solr/server/modules/https.mod +9 -0
- data/solr/server/modules/server.mod +11 -0
- data/solr/server/modules/ssl.mod +9 -0
- data/solr/server/resources/jetty-logging.properties +1 -0
- data/solr/server/resources/log4j.properties +24 -24
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-exec-1.3.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{hadoop-annotations-2.3.0.jar → hadoop-annotations-2.6.0.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.6.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.6.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.6.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/htrace-core-3.0.4.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.4.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.4.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.4.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-core-2.5.4.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-dataformat-smile-2.5.4.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-common-5.0.0.jar → lucene-analyzers-common-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-kuromoji-5.0.0.jar → lucene-analyzers-kuromoji-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-phonetic-5.0.0.jar → lucene-analyzers-phonetic-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-expressions-5.0.0.jar → lucene-expressions-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-grouping-5.0.0.jar → lucene-grouping-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-queryparser-5.0.0.jar → lucene-queryparser-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-sandbox-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/t-digest-3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/web.xml +169 -181
- data/solr/server/solr-webapp/webapp/WEB-INF/weblogic.xml +28 -28
- data/solr/server/solr-webapp/webapp/admin.html +164 -163
- data/solr/server/solr-webapp/webapp/css/angular/analysis.css +304 -0
- data/solr/server/solr-webapp/webapp/css/angular/chosen.css +465 -0
- data/solr/server/solr-webapp/webapp/css/angular/cloud.css +398 -0
- data/solr/server/solr-webapp/webapp/css/angular/common.css +724 -0
- data/solr/server/solr-webapp/webapp/css/angular/cores.css +233 -0
- data/solr/server/solr-webapp/webapp/css/angular/dataimport.css +370 -0
- data/solr/server/solr-webapp/webapp/css/angular/documents.css +179 -0
- data/solr/server/solr-webapp/webapp/css/angular/files.css +53 -0
- data/solr/server/solr-webapp/webapp/css/angular/index.css +206 -0
- data/solr/server/solr-webapp/webapp/css/angular/logging.css +376 -0
- data/solr/server/solr-webapp/webapp/css/angular/menu.css +321 -0
- data/solr/server/solr-webapp/webapp/css/angular/plugins.css +212 -0
- data/solr/server/solr-webapp/webapp/css/angular/query.css +162 -0
- data/solr/server/solr-webapp/webapp/css/angular/replication.css +500 -0
- data/solr/server/solr-webapp/webapp/css/angular/schema-browser.css +567 -0
- data/solr/server/solr-webapp/webapp/css/angular/segments.css +173 -0
- data/solr/server/solr-webapp/webapp/css/angular/threads.css +161 -0
- data/solr/server/solr-webapp/webapp/css/chosen.css +421 -421
- data/solr/server/solr-webapp/webapp/css/styles/analysis.css +311 -311
- data/solr/server/solr-webapp/webapp/css/styles/cloud.css +410 -410
- data/solr/server/solr-webapp/webapp/css/styles/common.css +701 -701
- data/solr/server/solr-webapp/webapp/css/styles/cores.css +244 -244
- data/solr/server/solr-webapp/webapp/css/styles/dashboard.css +155 -155
- data/solr/server/solr-webapp/webapp/css/styles/dataimport.css +403 -403
- data/solr/server/solr-webapp/webapp/css/styles/documents.css +197 -197
- data/solr/server/solr-webapp/webapp/css/styles/files.css +54 -54
- data/solr/server/solr-webapp/webapp/css/styles/index.css +207 -207
- data/solr/server/solr-webapp/webapp/css/styles/java-properties.css +52 -52
- data/solr/server/solr-webapp/webapp/css/styles/logging.css +391 -391
- data/solr/server/solr-webapp/webapp/css/styles/menu.css +329 -328
- data/solr/server/solr-webapp/webapp/css/styles/plugins.css +195 -195
- data/solr/server/solr-webapp/webapp/css/styles/query.css +173 -173
- data/solr/server/solr-webapp/webapp/css/styles/replication.css +515 -515
- data/solr/server/solr-webapp/webapp/css/styles/schema-browser.css +578 -578
- data/solr/server/solr-webapp/webapp/css/styles/segments.css +145 -0
- data/solr/server/solr-webapp/webapp/css/styles/threads.css +172 -172
- data/solr/server/solr-webapp/webapp/img/chosen-sprite-2x.png +0 -0
- data/solr/server/solr-webapp/webapp/img/filetypes/README +27 -27
- data/solr/server/solr-webapp/webapp/img/solr.svg +39 -39
- data/solr/server/solr-webapp/webapp/index.html +208 -0
- data/solr/server/solr-webapp/webapp/js/angular/app.js +713 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/analysis.js +199 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/cloud.js +528 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/core-overview.js +225 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/cores.js +465 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/dataimport.js +284 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/documents.js +139 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/files.js +92 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/index.js +95 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/java-properties.js +45 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/logging.js +146 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/plugins.js +166 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/query.js +99 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/replication.js +227 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/schema-browser.js +432 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/segments.js +94 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/threads.js +51 -0
- data/solr/server/solr-webapp/webapp/js/angular/services.js +214 -0
- data/solr/server/solr-webapp/webapp/js/lib/ZeroClipboard.js +342 -342
- data/solr/server/solr-webapp/webapp/js/lib/chosen.js +982 -982
- data/solr/server/solr-webapp/webapp/js/lib/console.js +29 -29
- data/solr/server/solr-webapp/webapp/js/lib/d3.js +9373 -9373
- data/solr/server/solr-webapp/webapp/js/lib/highlight.js +31 -31
- data/solr/server/solr-webapp/webapp/js/lib/jquery-1.7.2.min.js +30 -30
- data/solr/server/solr-webapp/webapp/js/lib/jquery.ajaxfileupload.js +184 -184
- data/solr/server/solr-webapp/webapp/js/lib/jquery.blockUI.js +523 -523
- data/solr/server/solr-webapp/webapp/js/lib/jquery.cookie.js +71 -71
- data/solr/server/solr-webapp/webapp/js/lib/jquery.form.js +806 -806
- data/solr/server/solr-webapp/webapp/js/lib/jquery.jstree.js +3534 -3534
- data/solr/server/solr-webapp/webapp/js/lib/jquery.sammy.js +1863 -1863
- data/solr/server/solr-webapp/webapp/js/lib/jquery.timeago.js +189 -189
- data/solr/server/solr-webapp/webapp/js/lib/linker.js +48 -48
- data/solr/server/solr-webapp/webapp/js/lib/naturalSort.js +82 -0
- data/solr/server/solr-webapp/webapp/js/lib/order.js +216 -216
- data/solr/server/solr-webapp/webapp/js/main.js +60 -58
- data/solr/server/solr-webapp/webapp/js/require.js +11349 -11349
- data/solr/server/solr-webapp/webapp/js/scripts/analysis.js +545 -545
- data/solr/server/solr-webapp/webapp/js/scripts/app.js +680 -679
- data/solr/server/solr-webapp/webapp/js/scripts/cloud.js +877 -877
- data/solr/server/solr-webapp/webapp/js/scripts/cores.js +719 -719
- data/solr/server/solr-webapp/webapp/js/scripts/dashboard.js +562 -562
- data/solr/server/solr-webapp/webapp/js/scripts/dataimport.js +812 -812
- data/solr/server/solr-webapp/webapp/js/scripts/documents.js +370 -370
- data/solr/server/solr-webapp/webapp/js/scripts/files.js +265 -265
- data/solr/server/solr-webapp/webapp/js/scripts/index.js +340 -340
- data/solr/server/solr-webapp/webapp/js/scripts/java-properties.js +106 -106
- data/solr/server/solr-webapp/webapp/js/scripts/logging.js +578 -576
- data/solr/server/solr-webapp/webapp/js/scripts/ping.js +72 -72
- data/solr/server/solr-webapp/webapp/js/scripts/plugins.js +462 -462
- data/solr/server/solr-webapp/webapp/js/scripts/query.js +229 -229
- data/solr/server/solr-webapp/webapp/js/scripts/replication.js +527 -527
- data/solr/server/solr-webapp/webapp/js/scripts/schema-browser.js +1229 -1229
- data/solr/server/solr-webapp/webapp/js/scripts/segments.js +206 -0
- data/solr/server/solr-webapp/webapp/js/scripts/threads.js +158 -158
- data/solr/server/solr-webapp/webapp/libs/angular-chosen.js +139 -0
- data/solr/server/solr-webapp/webapp/libs/angular-cookies.js +229 -0
- data/solr/server/solr-webapp/webapp/libs/angular-cookies.min.js +31 -0
- data/solr/server/solr-webapp/webapp/libs/angular-resource.min.js +36 -0
- data/solr/server/solr-webapp/webapp/libs/angular-route.js +1018 -0
- data/solr/server/solr-webapp/webapp/libs/angular-route.min.js +38 -0
- data/solr/server/solr-webapp/webapp/libs/angular-sanitize.js +703 -0
- data/solr/server/solr-webapp/webapp/libs/angular-sanitize.min.js +39 -0
- data/solr/server/solr-webapp/webapp/libs/angular.js +26093 -0
- data/solr/server/solr-webapp/webapp/libs/angular.min.js +273 -0
- data/solr/server/solr-webapp/webapp/libs/chosen.jquery.js +1194 -0
- data/solr/server/solr-webapp/webapp/libs/chosen.jquery.min.js +30 -0
- data/solr/server/solr-webapp/webapp/libs/d3.js +9373 -0
- data/solr/server/solr-webapp/webapp/libs/highlight.js +31 -0
- data/solr/server/solr-webapp/webapp/libs/jquery-2.1.3.min.js +29 -0
- data/solr/server/solr-webapp/webapp/libs/jquery.jstree.js +3534 -0
- data/solr/server/solr-webapp/webapp/libs/ngtimeago.js +102 -0
- data/solr/server/solr-webapp/webapp/partials/analysis.html +128 -0
- data/solr/server/solr-webapp/webapp/partials/cloud.html +104 -0
- data/solr/server/solr-webapp/webapp/partials/core_overview.html +227 -0
- data/solr/server/solr-webapp/webapp/partials/cores.html +231 -0
- data/solr/server/solr-webapp/webapp/partials/dataimport.html +209 -0
- data/solr/server/solr-webapp/webapp/partials/documents.html +118 -0
- data/solr/server/solr-webapp/webapp/partials/files.html +47 -0
- data/solr/server/solr-webapp/webapp/partials/index.html +261 -0
- data/solr/server/solr-webapp/webapp/partials/java-properties.html +27 -0
- data/solr/server/solr-webapp/webapp/partials/logging-levels.html +56 -0
- data/solr/server/solr-webapp/webapp/partials/logging.html +56 -0
- data/solr/server/solr-webapp/webapp/partials/plugins.html +72 -0
- data/solr/server/solr-webapp/webapp/partials/query.html +356 -0
- data/solr/server/solr-webapp/webapp/partials/replication.html +239 -0
- data/solr/server/solr-webapp/webapp/partials/schema-browser.html +206 -0
- data/solr/server/solr-webapp/webapp/partials/segments.html +99 -0
- data/solr/server/solr-webapp/webapp/partials/threads.html +65 -0
- data/solr/server/solr-webapp/webapp/tpl/analysis.html +83 -83
- data/solr/server/solr-webapp/webapp/tpl/cloud.html +87 -87
- data/solr/server/solr-webapp/webapp/tpl/cores.html +226 -226
- data/solr/server/solr-webapp/webapp/tpl/dashboard.html +201 -201
- data/solr/server/solr-webapp/webapp/tpl/dataimport.html +183 -183
- data/solr/server/solr-webapp/webapp/tpl/documents.html +107 -107
- data/solr/server/solr-webapp/webapp/tpl/files.html +44 -44
- data/solr/server/solr-webapp/webapp/tpl/index.html +250 -250
- data/solr/server/solr-webapp/webapp/tpl/logging.html +23 -23
- data/solr/server/solr-webapp/webapp/tpl/plugins.html +39 -39
- data/solr/server/solr-webapp/webapp/tpl/query.html +361 -361
- data/solr/server/solr-webapp/webapp/tpl/replication.html +216 -216
- data/solr/server/solr-webapp/webapp/tpl/schema-browser.html +192 -192
- data/solr/server/solr-webapp/webapp/tpl/segments.html +49 -0
- data/solr/server/solr-webapp/webapp/tpl/threads.html +56 -56
- data/solr/server/solr/README.txt +77 -77
- data/solr/server/solr/solr.xml +51 -51
- data/solr/server/solr/zoo.cfg +17 -17
- data/solr/server/start.jar +0 -0
- data/spec/server_spec.rb +3 -8
- metadata +132 -43
- data/solr/server/lib/jetty-continuation-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-deploy-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-http-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-io-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-jmx-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-security-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-server-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-servlet-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-util-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-webapp-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-xml-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/servlet-api-3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/.gitignore +0 -1
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.3.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.1.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.1.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.0.0.jar +0 -0
- data/solr/server/webapps/solr.war +0 -0
@@ -0,0 +1,139 @@
|
|
1
|
+
/*
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2013 Localytics http://www.localytics.com
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
*/
|
24
|
+
// Generated by CoffeeScript 1.8.0
|
25
|
+
(function() {
|
26
|
+
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
27
|
+
|
28
|
+
angular.module('localytics.directives', []);
|
29
|
+
|
30
|
+
angular.module('localytics.directives').directive('chosen', [
|
31
|
+
'$timeout', function($timeout) {
|
32
|
+
var CHOSEN_OPTION_WHITELIST, NG_OPTIONS_REGEXP, isEmpty, snakeCase;
|
33
|
+
NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/;
|
34
|
+
CHOSEN_OPTION_WHITELIST = ['noResultsText', 'allowSingleDeselect', 'disableSearchThreshold', 'disableSearch', 'enableSplitWordSearch', 'inheritSelectClasses', 'maxSelectedOptions', 'placeholderTextMultiple', 'placeholderTextSingle', 'searchContains', 'singleBackstrokeDelete', 'displayDisabledOptions', 'displaySelectedOptions', 'width'];
|
35
|
+
snakeCase = function(input) {
|
36
|
+
return input.replace(/[A-Z]/g, function($1) {
|
37
|
+
return "_" + ($1.toLowerCase());
|
38
|
+
});
|
39
|
+
};
|
40
|
+
isEmpty = function(value) {
|
41
|
+
var key;
|
42
|
+
if (angular.isArray(value)) {
|
43
|
+
return value.length === 0;
|
44
|
+
} else if (angular.isObject(value)) {
|
45
|
+
for (key in value) {
|
46
|
+
if (value.hasOwnProperty(key)) {
|
47
|
+
return false;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
return true;
|
52
|
+
};
|
53
|
+
return {
|
54
|
+
restrict: 'A',
|
55
|
+
require: '?ngModel',
|
56
|
+
terminal: true,
|
57
|
+
link: function(scope, element, attr, ngModel) {
|
58
|
+
var chosen, defaultText, disableWithMessage, empty, initOrUpdate, match, options, origRender, removeEmptyMessage, startLoading, stopLoading, valuesExpr, viewWatch;
|
59
|
+
element.addClass('localytics-chosen');
|
60
|
+
options = scope.$eval(attr.chosen) || {};
|
61
|
+
angular.forEach(attr, function(value, key) {
|
62
|
+
if (__indexOf.call(CHOSEN_OPTION_WHITELIST, key) >= 0) {
|
63
|
+
return options[snakeCase(key)] = scope.$eval(value);
|
64
|
+
}
|
65
|
+
});
|
66
|
+
startLoading = function() {
|
67
|
+
return element.addClass('loading').attr('disabled', true).trigger('chosen:updated');
|
68
|
+
};
|
69
|
+
stopLoading = function() {
|
70
|
+
return element.removeClass('loading').attr('disabled', false).trigger('chosen:updated');
|
71
|
+
};
|
72
|
+
chosen = null;
|
73
|
+
defaultText = null;
|
74
|
+
empty = false;
|
75
|
+
initOrUpdate = function() {
|
76
|
+
if (chosen) {
|
77
|
+
return element.trigger('chosen:updated');
|
78
|
+
} else {
|
79
|
+
chosen = element.chosen(options).data('chosen');
|
80
|
+
return defaultText = chosen.default_text;
|
81
|
+
}
|
82
|
+
};
|
83
|
+
removeEmptyMessage = function() {
|
84
|
+
empty = false;
|
85
|
+
return element.attr('data-placeholder', defaultText);
|
86
|
+
};
|
87
|
+
disableWithMessage = function() {
|
88
|
+
empty = true;
|
89
|
+
return element.attr('data-placeholder', chosen.results_none_found).attr('disabled', true).trigger('chosen:updated');
|
90
|
+
};
|
91
|
+
if (ngModel) {
|
92
|
+
origRender = ngModel.$render;
|
93
|
+
ngModel.$render = function() {
|
94
|
+
origRender();
|
95
|
+
return initOrUpdate();
|
96
|
+
};
|
97
|
+
if (attr.multiple) {
|
98
|
+
viewWatch = function() {
|
99
|
+
return ngModel.$viewValue;
|
100
|
+
};
|
101
|
+
scope.$watch(viewWatch, ngModel.$render, true);
|
102
|
+
}
|
103
|
+
} else {
|
104
|
+
initOrUpdate();
|
105
|
+
}
|
106
|
+
attr.$observe('disabled', function() {
|
107
|
+
return element.trigger('chosen:updated');
|
108
|
+
});
|
109
|
+
if (attr.ngOptions && ngModel) {
|
110
|
+
match = attr.ngOptions.match(NG_OPTIONS_REGEXP);
|
111
|
+
valuesExpr = match[7];
|
112
|
+
scope.$watchCollection(valuesExpr, function(newVal, oldVal) {
|
113
|
+
var timer;
|
114
|
+
return timer = $timeout(function() {
|
115
|
+
if (angular.isUndefined(newVal)) {
|
116
|
+
return startLoading();
|
117
|
+
} else {
|
118
|
+
if (empty) {
|
119
|
+
removeEmptyMessage();
|
120
|
+
}
|
121
|
+
stopLoading();
|
122
|
+
if (isEmpty(newVal)) {
|
123
|
+
return disableWithMessage();
|
124
|
+
}
|
125
|
+
}
|
126
|
+
});
|
127
|
+
});
|
128
|
+
return scope.$on('$destroy', function(event) {
|
129
|
+
if (typeof timer !== "undefined" && timer !== null) {
|
130
|
+
return $timeout.cancel(timer);
|
131
|
+
}
|
132
|
+
});
|
133
|
+
}
|
134
|
+
}
|
135
|
+
};
|
136
|
+
}
|
137
|
+
]);
|
138
|
+
|
139
|
+
}).call(this);
|
@@ -0,0 +1,229 @@
|
|
1
|
+
/**
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
*/
|
24
|
+
/**
|
25
|
+
* @license AngularJS v1.3.8
|
26
|
+
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
27
|
+
* License: MIT
|
28
|
+
*/
|
29
|
+
(function(window, angular, undefined) {'use strict';
|
30
|
+
|
31
|
+
/**
|
32
|
+
* @ngdoc module
|
33
|
+
* @name ngCookies
|
34
|
+
* @description
|
35
|
+
*
|
36
|
+
* # ngCookies
|
37
|
+
*
|
38
|
+
* The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
|
39
|
+
*
|
40
|
+
*
|
41
|
+
* <div doc-module-components="ngCookies"></div>
|
42
|
+
*
|
43
|
+
* See {@link ngCookies.$cookies `$cookies`} and
|
44
|
+
* {@link ngCookies.$cookieStore `$cookieStore`} for usage.
|
45
|
+
*/
|
46
|
+
|
47
|
+
|
48
|
+
angular.module('ngCookies', ['ng']).
|
49
|
+
/**
|
50
|
+
* @ngdoc service
|
51
|
+
* @name $cookies
|
52
|
+
*
|
53
|
+
* @description
|
54
|
+
* Provides read/write access to browser's cookies.
|
55
|
+
*
|
56
|
+
* Only a simple Object is exposed and by adding or removing properties to/from this object, new
|
57
|
+
* cookies are created/deleted at the end of current $eval.
|
58
|
+
* The object's properties can only be strings.
|
59
|
+
*
|
60
|
+
* Requires the {@link ngCookies `ngCookies`} module to be installed.
|
61
|
+
*
|
62
|
+
* @example
|
63
|
+
*
|
64
|
+
* ```js
|
65
|
+
* angular.module('cookiesExample', ['ngCookies'])
|
66
|
+
* .controller('ExampleController', ['$cookies', function($cookies) {
|
67
|
+
* // Retrieving a cookie
|
68
|
+
* var favoriteCookie = $cookies.myFavorite;
|
69
|
+
* // Setting a cookie
|
70
|
+
* $cookies.myFavorite = 'oatmeal';
|
71
|
+
* }]);
|
72
|
+
* ```
|
73
|
+
*/
|
74
|
+
factory('$cookies', ['$rootScope', '$browser', function($rootScope, $browser) {
|
75
|
+
var cookies = {},
|
76
|
+
lastCookies = {},
|
77
|
+
lastBrowserCookies,
|
78
|
+
runEval = false,
|
79
|
+
copy = angular.copy,
|
80
|
+
isUndefined = angular.isUndefined;
|
81
|
+
|
82
|
+
//creates a poller fn that copies all cookies from the $browser to service & inits the service
|
83
|
+
$browser.addPollFn(function() {
|
84
|
+
var currentCookies = $browser.cookies();
|
85
|
+
if (lastBrowserCookies != currentCookies) { //relies on browser.cookies() impl
|
86
|
+
lastBrowserCookies = currentCookies;
|
87
|
+
copy(currentCookies, lastCookies);
|
88
|
+
copy(currentCookies, cookies);
|
89
|
+
if (runEval) $rootScope.$apply();
|
90
|
+
}
|
91
|
+
})();
|
92
|
+
|
93
|
+
runEval = true;
|
94
|
+
|
95
|
+
//at the end of each eval, push cookies
|
96
|
+
//TODO: this should happen before the "delayed" watches fire, because if some cookies are not
|
97
|
+
// strings or browser refuses to store some cookies, we update the model in the push fn.
|
98
|
+
$rootScope.$watch(push);
|
99
|
+
|
100
|
+
return cookies;
|
101
|
+
|
102
|
+
|
103
|
+
/**
|
104
|
+
* Pushes all the cookies from the service to the browser and verifies if all cookies were
|
105
|
+
* stored.
|
106
|
+
*/
|
107
|
+
function push() {
|
108
|
+
var name,
|
109
|
+
value,
|
110
|
+
browserCookies,
|
111
|
+
updated;
|
112
|
+
|
113
|
+
//delete any cookies deleted in $cookies
|
114
|
+
for (name in lastCookies) {
|
115
|
+
if (isUndefined(cookies[name])) {
|
116
|
+
$browser.cookies(name, undefined);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
//update all cookies updated in $cookies
|
121
|
+
for (name in cookies) {
|
122
|
+
value = cookies[name];
|
123
|
+
if (!angular.isString(value)) {
|
124
|
+
value = '' + value;
|
125
|
+
cookies[name] = value;
|
126
|
+
}
|
127
|
+
if (value !== lastCookies[name]) {
|
128
|
+
$browser.cookies(name, value);
|
129
|
+
updated = true;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
//verify what was actually stored
|
134
|
+
if (updated) {
|
135
|
+
updated = false;
|
136
|
+
browserCookies = $browser.cookies();
|
137
|
+
|
138
|
+
for (name in cookies) {
|
139
|
+
if (cookies[name] !== browserCookies[name]) {
|
140
|
+
//delete or reset all cookies that the browser dropped from $cookies
|
141
|
+
if (isUndefined(browserCookies[name])) {
|
142
|
+
delete cookies[name];
|
143
|
+
} else {
|
144
|
+
cookies[name] = browserCookies[name];
|
145
|
+
}
|
146
|
+
updated = true;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}]).
|
152
|
+
|
153
|
+
|
154
|
+
/**
|
155
|
+
* @ngdoc service
|
156
|
+
* @name $cookieStore
|
157
|
+
* @requires $cookies
|
158
|
+
*
|
159
|
+
* @description
|
160
|
+
* Provides a key-value (string-object) storage, that is backed by session cookies.
|
161
|
+
* Objects put or retrieved from this storage are automatically serialized or
|
162
|
+
* deserialized by angular's toJson/fromJson.
|
163
|
+
*
|
164
|
+
* Requires the {@link ngCookies `ngCookies`} module to be installed.
|
165
|
+
*
|
166
|
+
* @example
|
167
|
+
*
|
168
|
+
* ```js
|
169
|
+
* angular.module('cookieStoreExample', ['ngCookies'])
|
170
|
+
* .controller('ExampleController', ['$cookieStore', function($cookieStore) {
|
171
|
+
* // Put cookie
|
172
|
+
* $cookieStore.put('myFavorite','oatmeal');
|
173
|
+
* // Get cookie
|
174
|
+
* var favoriteCookie = $cookieStore.get('myFavorite');
|
175
|
+
* // Removing a cookie
|
176
|
+
* $cookieStore.remove('myFavorite');
|
177
|
+
* }]);
|
178
|
+
* ```
|
179
|
+
*/
|
180
|
+
factory('$cookieStore', ['$cookies', function($cookies) {
|
181
|
+
|
182
|
+
return {
|
183
|
+
/**
|
184
|
+
* @ngdoc method
|
185
|
+
* @name $cookieStore#get
|
186
|
+
*
|
187
|
+
* @description
|
188
|
+
* Returns the value of given cookie key
|
189
|
+
*
|
190
|
+
* @param {string} key Id to use for lookup.
|
191
|
+
* @returns {Object} Deserialized cookie value.
|
192
|
+
*/
|
193
|
+
get: function(key) {
|
194
|
+
var value = $cookies[key];
|
195
|
+
return value ? angular.fromJson(value) : value;
|
196
|
+
},
|
197
|
+
|
198
|
+
/**
|
199
|
+
* @ngdoc method
|
200
|
+
* @name $cookieStore#put
|
201
|
+
*
|
202
|
+
* @description
|
203
|
+
* Sets a value for given cookie key
|
204
|
+
*
|
205
|
+
* @param {string} key Id for the `value`.
|
206
|
+
* @param {Object} value Value to be stored.
|
207
|
+
*/
|
208
|
+
put: function(key, value) {
|
209
|
+
$cookies[key] = angular.toJson(value);
|
210
|
+
},
|
211
|
+
|
212
|
+
/**
|
213
|
+
* @ngdoc method
|
214
|
+
* @name $cookieStore#remove
|
215
|
+
*
|
216
|
+
* @description
|
217
|
+
* Remove given cookie
|
218
|
+
*
|
219
|
+
* @param {string} key Id of the key-value pair to delete.
|
220
|
+
*/
|
221
|
+
remove: function(key) {
|
222
|
+
delete $cookies[key];
|
223
|
+
}
|
224
|
+
};
|
225
|
+
|
226
|
+
}]);
|
227
|
+
|
228
|
+
|
229
|
+
})(window, window.angular);
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/**
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
*/
|
24
|
+
/*
|
25
|
+
AngularJS v1.3.8
|
26
|
+
(c) 2010-2014 Google, Inc. http://angularjs.org
|
27
|
+
License: MIT
|
28
|
+
*/
|
29
|
+
(function(p,f,n){'use strict';f.module("ngCookies",["ng"]).factory("$cookies",["$rootScope","$browser",function(e,b){var c={},g={},h,k=!1,l=f.copy,m=f.isUndefined;b.addPollFn(function(){var a=b.cookies();h!=a&&(h=a,l(a,g),l(a,c),k&&e.$apply())})();k=!0;e.$watch(function(){var a,d,e;for(a in g)m(c[a])&&b.cookies(a,n);for(a in c)d=c[a],f.isString(d)||(d=""+d,c[a]=d),d!==g[a]&&(b.cookies(a,d),e=!0);if(e)for(a in d=b.cookies(),c)c[a]!==d[a]&&(m(d[a])?delete c[a]:c[a]=d[a])});return c}]).factory("$cookieStore",
|
30
|
+
["$cookies",function(e){return{get:function(b){return(b=e[b])?f.fromJson(b):b},put:function(b,c){e[b]=f.toJson(c)},remove:function(b){delete e[b]}}}])})(window,window.angular);
|
31
|
+
//# sourceMappingURL=angular-cookies.min.js.map
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/**
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
*/
|
24
|
+
/*
|
25
|
+
AngularJS v1.3.8
|
26
|
+
(c) 2010-2014 Google, Inc. http://angularjs.org
|
27
|
+
License: MIT
|
28
|
+
*/
|
29
|
+
(function(I,d,B){'use strict';function D(f,q){q=q||{};d.forEach(q,function(d,h){delete q[h]});for(var h in f)!f.hasOwnProperty(h)||"$"===h.charAt(0)&&"$"===h.charAt(1)||(q[h]=f[h]);return q}var w=d.$$minErr("$resource"),C=/^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;d.module("ngResource",["ng"]).provider("$resource",function(){var f=this;this.defaults={stripTrailingSlashes:!0,actions:{get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}}};
|
30
|
+
this.$get=["$http","$q",function(q,h){function t(d,g){this.template=d;this.defaults=s({},f.defaults,g);this.urlParams={}}function v(x,g,l,m){function c(b,k){var c={};k=s({},g,k);r(k,function(a,k){u(a)&&(a=a());var d;if(a&&a.charAt&&"@"==a.charAt(0)){d=b;var e=a.substr(1);if(null==e||""===e||"hasOwnProperty"===e||!C.test("."+e))throw w("badmember",e);for(var e=e.split("."),n=0,g=e.length;n<g&&d!==B;n++){var h=e[n];d=null!==d?d[h]:B}}else d=a;c[k]=d});return c}function F(b){return b.resource}function e(b){D(b||
|
31
|
+
{},this)}var G=new t(x,m);l=s({},f.defaults.actions,l);e.prototype.toJSON=function(){var b=s({},this);delete b.$promise;delete b.$resolved;return b};r(l,function(b,k){var g=/^(POST|PUT|PATCH)$/i.test(b.method);e[k]=function(a,y,m,x){var n={},f,l,z;switch(arguments.length){case 4:z=x,l=m;case 3:case 2:if(u(y)){if(u(a)){l=a;z=y;break}l=y;z=m}else{n=a;f=y;l=m;break}case 1:u(a)?l=a:g?f=a:n=a;break;case 0:break;default:throw w("badargs",arguments.length);}var t=this instanceof e,p=t?f:b.isArray?[]:new e(f),
|
32
|
+
A={},v=b.interceptor&&b.interceptor.response||F,C=b.interceptor&&b.interceptor.responseError||B;r(b,function(b,a){"params"!=a&&"isArray"!=a&&"interceptor"!=a&&(A[a]=H(b))});g&&(A.data=f);G.setUrlParams(A,s({},c(f,b.params||{}),n),b.url);n=q(A).then(function(a){var c=a.data,g=p.$promise;if(c){if(d.isArray(c)!==!!b.isArray)throw w("badcfg",k,b.isArray?"array":"object",d.isArray(c)?"array":"object");b.isArray?(p.length=0,r(c,function(a){"object"===typeof a?p.push(new e(a)):p.push(a)})):(D(c,p),p.$promise=
|
33
|
+
g)}p.$resolved=!0;a.resource=p;return a},function(a){p.$resolved=!0;(z||E)(a);return h.reject(a)});n=n.then(function(a){var b=v(a);(l||E)(b,a.headers);return b},C);return t?n:(p.$promise=n,p.$resolved=!1,p)};e.prototype["$"+k]=function(a,b,c){u(a)&&(c=b,b=a,a={});a=e[k].call(this,a,this,b,c);return a.$promise||a}});e.bind=function(b){return v(x,s({},g,b),l)};return e}var E=d.noop,r=d.forEach,s=d.extend,H=d.copy,u=d.isFunction;t.prototype={setUrlParams:function(f,g,l){var m=this,c=l||m.template,h,
|
34
|
+
e,q=m.urlParams={};r(c.split(/\W/),function(b){if("hasOwnProperty"===b)throw w("badname");!/^\d+$/.test(b)&&b&&(new RegExp("(^|[^\\\\]):"+b+"(\\W|$)")).test(c)&&(q[b]=!0)});c=c.replace(/\\:/g,":");g=g||{};r(m.urlParams,function(b,k){h=g.hasOwnProperty(k)?g[k]:m.defaults[k];d.isDefined(h)&&null!==h?(e=encodeURIComponent(h).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"%20").replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+"),c=c.replace(new RegExp(":"+
|
35
|
+
k+"(\\W|$)","g"),function(b,a){return e+a})):c=c.replace(new RegExp("(/?):"+k+"(\\W|$)","g"),function(b,a,c){return"/"==c.charAt(0)?c:a+c})});m.defaults.stripTrailingSlashes&&(c=c.replace(/\/+$/,"")||"/");c=c.replace(/\/\.(?=\w+($|\?))/,".");f.url=c.replace(/\/\\\./,"/.");r(g,function(b,c){m.urlParams[c]||(f.params=f.params||{},f.params[c]=b)})}};return v}]})})(window,window.angular);
|
36
|
+
//# sourceMappingURL=angular-resource.min.js.map
|
@@ -0,0 +1,1018 @@
|
|
1
|
+
/**
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
*/
|
24
|
+
/**
|
25
|
+
* @license AngularJS v1.3.8
|
26
|
+
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
27
|
+
* License: MIT
|
28
|
+
*/
|
29
|
+
(function(window, angular, undefined) {'use strict';
|
30
|
+
|
31
|
+
/**
|
32
|
+
* @ngdoc module
|
33
|
+
* @name ngRoute
|
34
|
+
* @description
|
35
|
+
*
|
36
|
+
* # ngRoute
|
37
|
+
*
|
38
|
+
* The `ngRoute` module provides routing and deeplinking services and directives for angular apps.
|
39
|
+
*
|
40
|
+
* ## Example
|
41
|
+
* See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
|
42
|
+
*
|
43
|
+
*
|
44
|
+
* <div doc-module-components="ngRoute"></div>
|
45
|
+
*/
|
46
|
+
/* global -ngRouteModule */
|
47
|
+
var ngRouteModule = angular.module('ngRoute', ['ng']).
|
48
|
+
provider('$route', $RouteProvider),
|
49
|
+
$routeMinErr = angular.$$minErr('ngRoute');
|
50
|
+
|
51
|
+
/**
|
52
|
+
* @ngdoc provider
|
53
|
+
* @name $routeProvider
|
54
|
+
*
|
55
|
+
* @description
|
56
|
+
*
|
57
|
+
* Used for configuring routes.
|
58
|
+
*
|
59
|
+
* ## Example
|
60
|
+
* See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
|
61
|
+
*
|
62
|
+
* ## Dependencies
|
63
|
+
* Requires the {@link ngRoute `ngRoute`} module to be installed.
|
64
|
+
*/
|
65
|
+
function $RouteProvider() {
|
66
|
+
function inherit(parent, extra) {
|
67
|
+
return angular.extend(Object.create(parent), extra);
|
68
|
+
}
|
69
|
+
|
70
|
+
var routes = {};
|
71
|
+
|
72
|
+
/**
|
73
|
+
* @ngdoc method
|
74
|
+
* @name $routeProvider#when
|
75
|
+
*
|
76
|
+
* @param {string} path Route path (matched against `$location.path`). If `$location.path`
|
77
|
+
* contains redundant trailing slash or is missing one, the route will still match and the
|
78
|
+
* `$location.path` will be updated to add or drop the trailing slash to exactly match the
|
79
|
+
* route definition.
|
80
|
+
*
|
81
|
+
* * `path` can contain named groups starting with a colon: e.g. `:name`. All characters up
|
82
|
+
* to the next slash are matched and stored in `$routeParams` under the given `name`
|
83
|
+
* when the route matches.
|
84
|
+
* * `path` can contain named groups starting with a colon and ending with a star:
|
85
|
+
* e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name`
|
86
|
+
* when the route matches.
|
87
|
+
* * `path` can contain optional named groups with a question mark: e.g.`:name?`.
|
88
|
+
*
|
89
|
+
* For example, routes like `/color/:color/largecode/:largecode*\/edit` will match
|
90
|
+
* `/color/brown/largecode/code/with/slashes/edit` and extract:
|
91
|
+
*
|
92
|
+
* * `color: brown`
|
93
|
+
* * `largecode: code/with/slashes`.
|
94
|
+
*
|
95
|
+
*
|
96
|
+
* @param {Object} route Mapping information to be assigned to `$route.current` on route
|
97
|
+
* match.
|
98
|
+
*
|
99
|
+
* Object properties:
|
100
|
+
*
|
101
|
+
* - `controller` – `{(string|function()=}` – Controller fn that should be associated with
|
102
|
+
* newly created scope or the name of a {@link angular.Module#controller registered
|
103
|
+
* controller} if passed as a string.
|
104
|
+
* - `controllerAs` – `{string=}` – A controller alias name. If present the controller will be
|
105
|
+
* published to scope under the `controllerAs` name.
|
106
|
+
* - `template` – `{string=|function()=}` – html template as a string or a function that
|
107
|
+
* returns an html template as a string which should be used by {@link
|
108
|
+
* ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives.
|
109
|
+
* This property takes precedence over `templateUrl`.
|
110
|
+
*
|
111
|
+
* If `template` is a function, it will be called with the following parameters:
|
112
|
+
*
|
113
|
+
* - `{Array.<Object>}` - route parameters extracted from the current
|
114
|
+
* `$location.path()` by applying the current route
|
115
|
+
*
|
116
|
+
* - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
|
117
|
+
* template that should be used by {@link ngRoute.directive:ngView ngView}.
|
118
|
+
*
|
119
|
+
* If `templateUrl` is a function, it will be called with the following parameters:
|
120
|
+
*
|
121
|
+
* - `{Array.<Object>}` - route parameters extracted from the current
|
122
|
+
* `$location.path()` by applying the current route
|
123
|
+
*
|
124
|
+
* - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
|
125
|
+
* be injected into the controller. If any of these dependencies are promises, the router
|
126
|
+
* will wait for them all to be resolved or one to be rejected before the controller is
|
127
|
+
* instantiated.
|
128
|
+
* If all the promises are resolved successfully, the values of the resolved promises are
|
129
|
+
* injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is
|
130
|
+
* fired. If any of the promises are rejected the
|
131
|
+
* {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired. The map object
|
132
|
+
* is:
|
133
|
+
*
|
134
|
+
* - `key` – `{string}`: a name of a dependency to be injected into the controller.
|
135
|
+
* - `factory` - `{string|function}`: If `string` then it is an alias for a service.
|
136
|
+
* Otherwise if function, then it is {@link auto.$injector#invoke injected}
|
137
|
+
* and the return value is treated as the dependency. If the result is a promise, it is
|
138
|
+
* resolved before its value is injected into the controller. Be aware that
|
139
|
+
* `ngRoute.$routeParams` will still refer to the previous route within these resolve
|
140
|
+
* functions. Use `$route.current.params` to access the new route parameters, instead.
|
141
|
+
*
|
142
|
+
* - `redirectTo` – {(string|function())=} – value to update
|
143
|
+
* {@link ng.$location $location} path with and trigger route redirection.
|
144
|
+
*
|
145
|
+
* If `redirectTo` is a function, it will be called with the following parameters:
|
146
|
+
*
|
147
|
+
* - `{Object.<string>}` - route parameters extracted from the current
|
148
|
+
* `$location.path()` by applying the current route templateUrl.
|
149
|
+
* - `{string}` - current `$location.path()`
|
150
|
+
* - `{Object}` - current `$location.search()`
|
151
|
+
*
|
152
|
+
* The custom `redirectTo` function is expected to return a string which will be used
|
153
|
+
* to update `$location.path()` and `$location.search()`.
|
154
|
+
*
|
155
|
+
* - `[reloadOnSearch=true]` - {boolean=} - reload route when only `$location.search()`
|
156
|
+
* or `$location.hash()` changes.
|
157
|
+
*
|
158
|
+
* If the option is set to `false` and url in the browser changes, then
|
159
|
+
* `$routeUpdate` event is broadcasted on the root scope.
|
160
|
+
*
|
161
|
+
* - `[caseInsensitiveMatch=false]` - {boolean=} - match routes without being case sensitive
|
162
|
+
*
|
163
|
+
* If the option is set to `true`, then the particular route can be matched without being
|
164
|
+
* case sensitive
|
165
|
+
*
|
166
|
+
* @returns {Object} self
|
167
|
+
*
|
168
|
+
* @description
|
169
|
+
* Adds a new route definition to the `$route` service.
|
170
|
+
*/
|
171
|
+
this.when = function(path, route) {
|
172
|
+
//copy original route object to preserve params inherited from proto chain
|
173
|
+
var routeCopy = angular.copy(route);
|
174
|
+
if (angular.isUndefined(routeCopy.reloadOnSearch)) {
|
175
|
+
routeCopy.reloadOnSearch = true;
|
176
|
+
}
|
177
|
+
if (angular.isUndefined(routeCopy.caseInsensitiveMatch)) {
|
178
|
+
routeCopy.caseInsensitiveMatch = this.caseInsensitiveMatch;
|
179
|
+
}
|
180
|
+
routes[path] = angular.extend(
|
181
|
+
routeCopy,
|
182
|
+
path && pathRegExp(path, routeCopy)
|
183
|
+
);
|
184
|
+
|
185
|
+
// create redirection for trailing slashes
|
186
|
+
if (path) {
|
187
|
+
var redirectPath = (path[path.length - 1] == '/')
|
188
|
+
? path.substr(0, path.length - 1)
|
189
|
+
: path + '/';
|
190
|
+
|
191
|
+
routes[redirectPath] = angular.extend(
|
192
|
+
{redirectTo: path},
|
193
|
+
pathRegExp(redirectPath, routeCopy)
|
194
|
+
);
|
195
|
+
}
|
196
|
+
|
197
|
+
return this;
|
198
|
+
};
|
199
|
+
|
200
|
+
/**
|
201
|
+
* @ngdoc property
|
202
|
+
* @name $routeProvider#caseInsensitiveMatch
|
203
|
+
* @description
|
204
|
+
*
|
205
|
+
* A boolean property indicating if routes defined
|
206
|
+
* using this provider should be matched using a case insensitive
|
207
|
+
* algorithm. Defaults to `false`.
|
208
|
+
*/
|
209
|
+
this.caseInsensitiveMatch = false;
|
210
|
+
|
211
|
+
/**
|
212
|
+
* @param path {string} path
|
213
|
+
* @param opts {Object} options
|
214
|
+
* @return {?Object}
|
215
|
+
*
|
216
|
+
* @description
|
217
|
+
* Normalizes the given path, returning a regular expression
|
218
|
+
* and the original path.
|
219
|
+
*
|
220
|
+
* Inspired by pathRexp in visionmedia/express/lib/utils.js.
|
221
|
+
*/
|
222
|
+
function pathRegExp(path, opts) {
|
223
|
+
var insensitive = opts.caseInsensitiveMatch,
|
224
|
+
ret = {
|
225
|
+
originalPath: path,
|
226
|
+
regexp: path
|
227
|
+
},
|
228
|
+
keys = ret.keys = [];
|
229
|
+
|
230
|
+
path = path
|
231
|
+
.replace(/([().])/g, '\\$1')
|
232
|
+
.replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option) {
|
233
|
+
var optional = option === '?' ? option : null;
|
234
|
+
var star = option === '*' ? option : null;
|
235
|
+
keys.push({ name: key, optional: !!optional });
|
236
|
+
slash = slash || '';
|
237
|
+
return ''
|
238
|
+
+ (optional ? '' : slash)
|
239
|
+
+ '(?:'
|
240
|
+
+ (optional ? slash : '')
|
241
|
+
+ (star && '(.+?)' || '([^/]+)')
|
242
|
+
+ (optional || '')
|
243
|
+
+ ')'
|
244
|
+
+ (optional || '');
|
245
|
+
})
|
246
|
+
.replace(/([\/$\*])/g, '\\$1');
|
247
|
+
|
248
|
+
ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : '');
|
249
|
+
return ret;
|
250
|
+
}
|
251
|
+
|
252
|
+
/**
|
253
|
+
* @ngdoc method
|
254
|
+
* @name $routeProvider#otherwise
|
255
|
+
*
|
256
|
+
* @description
|
257
|
+
* Sets route definition that will be used on route change when no other route definition
|
258
|
+
* is matched.
|
259
|
+
*
|
260
|
+
* @param {Object|string} params Mapping information to be assigned to `$route.current`.
|
261
|
+
* If called with a string, the value maps to `redirectTo`.
|
262
|
+
* @returns {Object} self
|
263
|
+
*/
|
264
|
+
this.otherwise = function(params) {
|
265
|
+
if (typeof params === 'string') {
|
266
|
+
params = {redirectTo: params};
|
267
|
+
}
|
268
|
+
this.when(null, params);
|
269
|
+
return this;
|
270
|
+
};
|
271
|
+
|
272
|
+
|
273
|
+
this.$get = ['$rootScope',
|
274
|
+
'$location',
|
275
|
+
'$routeParams',
|
276
|
+
'$q',
|
277
|
+
'$injector',
|
278
|
+
'$templateRequest',
|
279
|
+
'$sce',
|
280
|
+
function($rootScope, $location, $routeParams, $q, $injector, $templateRequest, $sce) {
|
281
|
+
|
282
|
+
/**
|
283
|
+
* @ngdoc service
|
284
|
+
* @name $route
|
285
|
+
* @requires $location
|
286
|
+
* @requires $routeParams
|
287
|
+
*
|
288
|
+
* @property {Object} current Reference to the current route definition.
|
289
|
+
* The route definition contains:
|
290
|
+
*
|
291
|
+
* - `controller`: The controller constructor as define in route definition.
|
292
|
+
* - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for
|
293
|
+
* controller instantiation. The `locals` contain
|
294
|
+
* the resolved values of the `resolve` map. Additionally the `locals` also contain:
|
295
|
+
*
|
296
|
+
* - `$scope` - The current route scope.
|
297
|
+
* - `$template` - The current route template HTML.
|
298
|
+
*
|
299
|
+
* @property {Object} routes Object with all route configuration Objects as its properties.
|
300
|
+
*
|
301
|
+
* @description
|
302
|
+
* `$route` is used for deep-linking URLs to controllers and views (HTML partials).
|
303
|
+
* It watches `$location.url()` and tries to map the path to an existing route definition.
|
304
|
+
*
|
305
|
+
* Requires the {@link ngRoute `ngRoute`} module to be installed.
|
306
|
+
*
|
307
|
+
* You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API.
|
308
|
+
*
|
309
|
+
* The `$route` service is typically used in conjunction with the
|
310
|
+
* {@link ngRoute.directive:ngView `ngView`} directive and the
|
311
|
+
* {@link ngRoute.$routeParams `$routeParams`} service.
|
312
|
+
*
|
313
|
+
* @example
|
314
|
+
* This example shows how changing the URL hash causes the `$route` to match a route against the
|
315
|
+
* URL, and the `ngView` pulls in the partial.
|
316
|
+
*
|
317
|
+
* <example name="$route-service" module="ngRouteExample"
|
318
|
+
* deps="angular-route.js" fixBase="true">
|
319
|
+
* <file name="index.html">
|
320
|
+
* <div ng-controller="MainController">
|
321
|
+
* Choose:
|
322
|
+
* <a href="Book/Moby">Moby</a> |
|
323
|
+
* <a href="Book/Moby/ch/1">Moby: Ch1</a> |
|
324
|
+
* <a href="Book/Gatsby">Gatsby</a> |
|
325
|
+
* <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
|
326
|
+
* <a href="Book/Scarlet">Scarlet Letter</a><br/>
|
327
|
+
*
|
328
|
+
* <div ng-view></div>
|
329
|
+
*
|
330
|
+
* <hr />
|
331
|
+
*
|
332
|
+
* <pre>$location.path() = {{$location.path()}}</pre>
|
333
|
+
* <pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
|
334
|
+
* <pre>$route.current.params = {{$route.current.params}}</pre>
|
335
|
+
* <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
|
336
|
+
* <pre>$routeParams = {{$routeParams}}</pre>
|
337
|
+
* </div>
|
338
|
+
* </file>
|
339
|
+
*
|
340
|
+
* <file name="book.html">
|
341
|
+
* controller: {{name}}<br />
|
342
|
+
* Book Id: {{params.bookId}}<br />
|
343
|
+
* </file>
|
344
|
+
*
|
345
|
+
* <file name="chapter.html">
|
346
|
+
* controller: {{name}}<br />
|
347
|
+
* Book Id: {{params.bookId}}<br />
|
348
|
+
* Chapter Id: {{params.chapterId}}
|
349
|
+
* </file>
|
350
|
+
*
|
351
|
+
* <file name="script.js">
|
352
|
+
* angular.module('ngRouteExample', ['ngRoute'])
|
353
|
+
*
|
354
|
+
* .controller('MainController', function($scope, $route, $routeParams, $location) {
|
355
|
+
* $scope.$route = $route;
|
356
|
+
* $scope.$location = $location;
|
357
|
+
* $scope.$routeParams = $routeParams;
|
358
|
+
* })
|
359
|
+
*
|
360
|
+
* .controller('BookController', function($scope, $routeParams) {
|
361
|
+
* $scope.name = "BookController";
|
362
|
+
* $scope.params = $routeParams;
|
363
|
+
* })
|
364
|
+
*
|
365
|
+
* .controller('ChapterController', function($scope, $routeParams) {
|
366
|
+
* $scope.name = "ChapterController";
|
367
|
+
* $scope.params = $routeParams;
|
368
|
+
* })
|
369
|
+
*
|
370
|
+
* .config(function($routeProvider, $locationProvider) {
|
371
|
+
* $routeProvider
|
372
|
+
* .when('/Book/:bookId', {
|
373
|
+
* templateUrl: 'book.html',
|
374
|
+
* controller: 'BookController',
|
375
|
+
* resolve: {
|
376
|
+
* // I will cause a 1 second delay
|
377
|
+
* delay: function($q, $timeout) {
|
378
|
+
* var delay = $q.defer();
|
379
|
+
* $timeout(delay.resolve, 1000);
|
380
|
+
* return delay.promise;
|
381
|
+
* }
|
382
|
+
* }
|
383
|
+
* })
|
384
|
+
* .when('/Book/:bookId/ch/:chapterId', {
|
385
|
+
* templateUrl: 'chapter.html',
|
386
|
+
* controller: 'ChapterController'
|
387
|
+
* });
|
388
|
+
*
|
389
|
+
* // configure html5 to get links working on jsfiddle
|
390
|
+
* $locationProvider.html5Mode(true);
|
391
|
+
* });
|
392
|
+
*
|
393
|
+
* </file>
|
394
|
+
*
|
395
|
+
* <file name="protractor.js" type="protractor">
|
396
|
+
* it('should load and compile correct template', function() {
|
397
|
+
* element(by.linkText('Moby: Ch1')).click();
|
398
|
+
* var content = element(by.css('[ng-view]')).getText();
|
399
|
+
* expect(content).toMatch(/controller\: ChapterController/);
|
400
|
+
* expect(content).toMatch(/Book Id\: Moby/);
|
401
|
+
* expect(content).toMatch(/Chapter Id\: 1/);
|
402
|
+
*
|
403
|
+
* element(by.partialLinkText('Scarlet')).click();
|
404
|
+
*
|
405
|
+
* content = element(by.css('[ng-view]')).getText();
|
406
|
+
* expect(content).toMatch(/controller\: BookController/);
|
407
|
+
* expect(content).toMatch(/Book Id\: Scarlet/);
|
408
|
+
* });
|
409
|
+
* </file>
|
410
|
+
* </example>
|
411
|
+
*/
|
412
|
+
|
413
|
+
/**
|
414
|
+
* @ngdoc event
|
415
|
+
* @name $route#$routeChangeStart
|
416
|
+
* @eventType broadcast on root scope
|
417
|
+
* @description
|
418
|
+
* Broadcasted before a route change. At this point the route services starts
|
419
|
+
* resolving all of the dependencies needed for the route change to occur.
|
420
|
+
* Typically this involves fetching the view template as well as any dependencies
|
421
|
+
* defined in `resolve` route property. Once all of the dependencies are resolved
|
422
|
+
* `$routeChangeSuccess` is fired.
|
423
|
+
*
|
424
|
+
* The route change (and the `$location` change that triggered it) can be prevented
|
425
|
+
* by calling `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on}
|
426
|
+
* for more details about event object.
|
427
|
+
*
|
428
|
+
* @param {Object} angularEvent Synthetic event object.
|
429
|
+
* @param {Route} next Future route information.
|
430
|
+
* @param {Route} current Current route information.
|
431
|
+
*/
|
432
|
+
|
433
|
+
/**
|
434
|
+
* @ngdoc event
|
435
|
+
* @name $route#$routeChangeSuccess
|
436
|
+
* @eventType broadcast on root scope
|
437
|
+
* @description
|
438
|
+
* Broadcasted after a route dependencies are resolved.
|
439
|
+
* {@link ngRoute.directive:ngView ngView} listens for the directive
|
440
|
+
* to instantiate the controller and render the view.
|
441
|
+
*
|
442
|
+
* @param {Object} angularEvent Synthetic event object.
|
443
|
+
* @param {Route} current Current route information.
|
444
|
+
* @param {Route|Undefined} previous Previous route information, or undefined if current is
|
445
|
+
* first route entered.
|
446
|
+
*/
|
447
|
+
|
448
|
+
/**
|
449
|
+
* @ngdoc event
|
450
|
+
* @name $route#$routeChangeError
|
451
|
+
* @eventType broadcast on root scope
|
452
|
+
* @description
|
453
|
+
* Broadcasted if any of the resolve promises are rejected.
|
454
|
+
*
|
455
|
+
* @param {Object} angularEvent Synthetic event object
|
456
|
+
* @param {Route} current Current route information.
|
457
|
+
* @param {Route} previous Previous route information.
|
458
|
+
* @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.
|
459
|
+
*/
|
460
|
+
|
461
|
+
/**
|
462
|
+
* @ngdoc event
|
463
|
+
* @name $route#$routeUpdate
|
464
|
+
* @eventType broadcast on root scope
|
465
|
+
* @description
|
466
|
+
*
|
467
|
+
* The `reloadOnSearch` property has been set to false, and we are reusing the same
|
468
|
+
* instance of the Controller.
|
469
|
+
*/
|
470
|
+
|
471
|
+
var forceReload = false,
|
472
|
+
preparedRoute,
|
473
|
+
preparedRouteIsUpdateOnly,
|
474
|
+
$route = {
|
475
|
+
routes: routes,
|
476
|
+
|
477
|
+
/**
|
478
|
+
* @ngdoc method
|
479
|
+
* @name $route#reload
|
480
|
+
*
|
481
|
+
* @description
|
482
|
+
* Causes `$route` service to reload the current route even if
|
483
|
+
* {@link ng.$location $location} hasn't changed.
|
484
|
+
*
|
485
|
+
* As a result of that, {@link ngRoute.directive:ngView ngView}
|
486
|
+
* creates new scope and reinstantiates the controller.
|
487
|
+
*/
|
488
|
+
reload: function() {
|
489
|
+
forceReload = true;
|
490
|
+
$rootScope.$evalAsync(function() {
|
491
|
+
// Don't support cancellation of a reload for now...
|
492
|
+
prepareRoute();
|
493
|
+
commitRoute();
|
494
|
+
});
|
495
|
+
},
|
496
|
+
|
497
|
+
/**
|
498
|
+
* @ngdoc method
|
499
|
+
* @name $route#updateParams
|
500
|
+
*
|
501
|
+
* @description
|
502
|
+
* Causes `$route` service to update the current URL, replacing
|
503
|
+
* current route parameters with those specified in `newParams`.
|
504
|
+
* Provided property names that match the route's path segment
|
505
|
+
* definitions will be interpolated into the location's path, while
|
506
|
+
* remaining properties will be treated as query params.
|
507
|
+
*
|
508
|
+
* @param {Object} newParams mapping of URL parameter names to values
|
509
|
+
*/
|
510
|
+
updateParams: function(newParams) {
|
511
|
+
if (this.current && this.current.$$route) {
|
512
|
+
var searchParams = {}, self=this;
|
513
|
+
|
514
|
+
angular.forEach(Object.keys(newParams), function(key) {
|
515
|
+
if (!self.current.pathParams[key]) searchParams[key] = newParams[key];
|
516
|
+
});
|
517
|
+
|
518
|
+
newParams = angular.extend({}, this.current.params, newParams);
|
519
|
+
$location.path(interpolate(this.current.$$route.originalPath, newParams));
|
520
|
+
$location.search(angular.extend({}, $location.search(), searchParams));
|
521
|
+
}
|
522
|
+
else {
|
523
|
+
throw $routeMinErr('norout', 'Tried updating route when with no current route');
|
524
|
+
}
|
525
|
+
}
|
526
|
+
};
|
527
|
+
|
528
|
+
$rootScope.$on('$locationChangeStart', prepareRoute);
|
529
|
+
$rootScope.$on('$locationChangeSuccess', commitRoute);
|
530
|
+
|
531
|
+
return $route;
|
532
|
+
|
533
|
+
/////////////////////////////////////////////////////
|
534
|
+
|
535
|
+
/**
|
536
|
+
* @param on {string} current url
|
537
|
+
* @param route {Object} route regexp to match the url against
|
538
|
+
* @return {?Object}
|
539
|
+
*
|
540
|
+
* @description
|
541
|
+
* Check if the route matches the current url.
|
542
|
+
*
|
543
|
+
* Inspired by match in
|
544
|
+
* visionmedia/express/lib/router/router.js.
|
545
|
+
*/
|
546
|
+
function switchRouteMatcher(on, route) {
|
547
|
+
var keys = route.keys,
|
548
|
+
params = {};
|
549
|
+
|
550
|
+
if (!route.regexp) return null;
|
551
|
+
|
552
|
+
var m = route.regexp.exec(on);
|
553
|
+
if (!m) return null;
|
554
|
+
|
555
|
+
for (var i = 1, len = m.length; i < len; ++i) {
|
556
|
+
var key = keys[i - 1];
|
557
|
+
|
558
|
+
var val = m[i];
|
559
|
+
|
560
|
+
if (key && val) {
|
561
|
+
params[key.name] = val;
|
562
|
+
}
|
563
|
+
}
|
564
|
+
return params;
|
565
|
+
}
|
566
|
+
|
567
|
+
function prepareRoute($locationEvent) {
|
568
|
+
var lastRoute = $route.current;
|
569
|
+
|
570
|
+
preparedRoute = parseRoute();
|
571
|
+
preparedRouteIsUpdateOnly = preparedRoute && lastRoute && preparedRoute.$$route === lastRoute.$$route
|
572
|
+
&& angular.equals(preparedRoute.pathParams, lastRoute.pathParams)
|
573
|
+
&& !preparedRoute.reloadOnSearch && !forceReload;
|
574
|
+
|
575
|
+
if (!preparedRouteIsUpdateOnly && (lastRoute || preparedRoute)) {
|
576
|
+
if ($rootScope.$broadcast('$routeChangeStart', preparedRoute, lastRoute).defaultPrevented) {
|
577
|
+
if ($locationEvent) {
|
578
|
+
$locationEvent.preventDefault();
|
579
|
+
}
|
580
|
+
}
|
581
|
+
}
|
582
|
+
}
|
583
|
+
|
584
|
+
function commitRoute() {
|
585
|
+
var lastRoute = $route.current;
|
586
|
+
var nextRoute = preparedRoute;
|
587
|
+
|
588
|
+
if (preparedRouteIsUpdateOnly) {
|
589
|
+
lastRoute.params = nextRoute.params;
|
590
|
+
angular.copy(lastRoute.params, $routeParams);
|
591
|
+
$rootScope.$broadcast('$routeUpdate', lastRoute);
|
592
|
+
} else if (nextRoute || lastRoute) {
|
593
|
+
forceReload = false;
|
594
|
+
$route.current = nextRoute;
|
595
|
+
if (nextRoute) {
|
596
|
+
if (nextRoute.redirectTo) {
|
597
|
+
if (angular.isString(nextRoute.redirectTo)) {
|
598
|
+
$location.path(interpolate(nextRoute.redirectTo, nextRoute.params)).search(nextRoute.params)
|
599
|
+
.replace();
|
600
|
+
} else {
|
601
|
+
$location.url(nextRoute.redirectTo(nextRoute.pathParams, $location.path(), $location.search()))
|
602
|
+
.replace();
|
603
|
+
}
|
604
|
+
}
|
605
|
+
}
|
606
|
+
|
607
|
+
$q.when(nextRoute).
|
608
|
+
then(function() {
|
609
|
+
if (nextRoute) {
|
610
|
+
var locals = angular.extend({}, nextRoute.resolve),
|
611
|
+
template, templateUrl;
|
612
|
+
|
613
|
+
angular.forEach(locals, function(value, key) {
|
614
|
+
locals[key] = angular.isString(value) ?
|
615
|
+
$injector.get(value) : $injector.invoke(value, null, null, key);
|
616
|
+
});
|
617
|
+
|
618
|
+
if (angular.isDefined(template = nextRoute.template)) {
|
619
|
+
if (angular.isFunction(template)) {
|
620
|
+
template = template(nextRoute.params);
|
621
|
+
}
|
622
|
+
} else if (angular.isDefined(templateUrl = nextRoute.templateUrl)) {
|
623
|
+
if (angular.isFunction(templateUrl)) {
|
624
|
+
templateUrl = templateUrl(nextRoute.params);
|
625
|
+
}
|
626
|
+
templateUrl = $sce.getTrustedResourceUrl(templateUrl);
|
627
|
+
if (angular.isDefined(templateUrl)) {
|
628
|
+
nextRoute.loadedTemplateUrl = templateUrl;
|
629
|
+
template = $templateRequest(templateUrl);
|
630
|
+
}
|
631
|
+
}
|
632
|
+
if (angular.isDefined(template)) {
|
633
|
+
locals['$template'] = template;
|
634
|
+
}
|
635
|
+
return $q.all(locals);
|
636
|
+
}
|
637
|
+
}).
|
638
|
+
// after route change
|
639
|
+
then(function(locals) {
|
640
|
+
if (nextRoute == $route.current) {
|
641
|
+
if (nextRoute) {
|
642
|
+
nextRoute.locals = locals;
|
643
|
+
angular.copy(nextRoute.params, $routeParams);
|
644
|
+
}
|
645
|
+
$rootScope.$broadcast('$routeChangeSuccess', nextRoute, lastRoute);
|
646
|
+
}
|
647
|
+
}, function(error) {
|
648
|
+
if (nextRoute == $route.current) {
|
649
|
+
$rootScope.$broadcast('$routeChangeError', nextRoute, lastRoute, error);
|
650
|
+
}
|
651
|
+
});
|
652
|
+
}
|
653
|
+
}
|
654
|
+
|
655
|
+
|
656
|
+
/**
|
657
|
+
* @returns {Object} the current active route, by matching it against the URL
|
658
|
+
*/
|
659
|
+
function parseRoute() {
|
660
|
+
// Match a route
|
661
|
+
var params, match;
|
662
|
+
angular.forEach(routes, function(route, path) {
|
663
|
+
if (!match && (params = switchRouteMatcher($location.path(), route))) {
|
664
|
+
match = inherit(route, {
|
665
|
+
params: angular.extend({}, $location.search(), params),
|
666
|
+
pathParams: params});
|
667
|
+
match.$$route = route;
|
668
|
+
}
|
669
|
+
});
|
670
|
+
// No route matched; fallback to "otherwise" route
|
671
|
+
return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});
|
672
|
+
}
|
673
|
+
|
674
|
+
/**
|
675
|
+
* @returns {string} interpolation of the redirect path with the parameters
|
676
|
+
*/
|
677
|
+
function interpolate(string, params) {
|
678
|
+
var result = [];
|
679
|
+
angular.forEach((string || '').split(':'), function(segment, i) {
|
680
|
+
if (i === 0) {
|
681
|
+
result.push(segment);
|
682
|
+
} else {
|
683
|
+
var segmentMatch = segment.match(/(\w+)(?:[?*])?(.*)/);
|
684
|
+
var key = segmentMatch[1];
|
685
|
+
result.push(params[key]);
|
686
|
+
result.push(segmentMatch[2] || '');
|
687
|
+
delete params[key];
|
688
|
+
}
|
689
|
+
});
|
690
|
+
return result.join('');
|
691
|
+
}
|
692
|
+
}];
|
693
|
+
}
|
694
|
+
|
695
|
+
ngRouteModule.provider('$routeParams', $RouteParamsProvider);
|
696
|
+
|
697
|
+
|
698
|
+
/**
|
699
|
+
* @ngdoc service
|
700
|
+
* @name $routeParams
|
701
|
+
* @requires $route
|
702
|
+
*
|
703
|
+
* @description
|
704
|
+
* The `$routeParams` service allows you to retrieve the current set of route parameters.
|
705
|
+
*
|
706
|
+
* Requires the {@link ngRoute `ngRoute`} module to be installed.
|
707
|
+
*
|
708
|
+
* The route parameters are a combination of {@link ng.$location `$location`}'s
|
709
|
+
* {@link ng.$location#search `search()`} and {@link ng.$location#path `path()`}.
|
710
|
+
* The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched.
|
711
|
+
*
|
712
|
+
* In case of parameter name collision, `path` params take precedence over `search` params.
|
713
|
+
*
|
714
|
+
* The service guarantees that the identity of the `$routeParams` object will remain unchanged
|
715
|
+
* (but its properties will likely change) even when a route change occurs.
|
716
|
+
*
|
717
|
+
* Note that the `$routeParams` are only updated *after* a route change completes successfully.
|
718
|
+
* This means that you cannot rely on `$routeParams` being correct in route resolve functions.
|
719
|
+
* Instead you can use `$route.current.params` to access the new route's parameters.
|
720
|
+
*
|
721
|
+
* @example
|
722
|
+
* ```js
|
723
|
+
* // Given:
|
724
|
+
* // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
|
725
|
+
* // Route: /Chapter/:chapterId/Section/:sectionId
|
726
|
+
* //
|
727
|
+
* // Then
|
728
|
+
* $routeParams ==> {chapterId:'1', sectionId:'2', search:'moby'}
|
729
|
+
* ```
|
730
|
+
*/
|
731
|
+
function $RouteParamsProvider() {
|
732
|
+
this.$get = function() { return {}; };
|
733
|
+
}
|
734
|
+
|
735
|
+
ngRouteModule.directive('ngView', ngViewFactory);
|
736
|
+
ngRouteModule.directive('ngView', ngViewFillContentFactory);
|
737
|
+
|
738
|
+
|
739
|
+
/**
|
740
|
+
* @ngdoc directive
|
741
|
+
* @name ngView
|
742
|
+
* @restrict ECA
|
743
|
+
*
|
744
|
+
* @description
|
745
|
+
* # Overview
|
746
|
+
* `ngView` is a directive that complements the {@link ngRoute.$route $route} service by
|
747
|
+
* including the rendered template of the current route into the main layout (`index.html`) file.
|
748
|
+
* Every time the current route changes, the included view changes with it according to the
|
749
|
+
* configuration of the `$route` service.
|
750
|
+
*
|
751
|
+
* Requires the {@link ngRoute `ngRoute`} module to be installed.
|
752
|
+
*
|
753
|
+
* @animations
|
754
|
+
* enter - animation is used to bring new content into the browser.
|
755
|
+
* leave - animation is used to animate existing content away.
|
756
|
+
*
|
757
|
+
* The enter and leave animation occur concurrently.
|
758
|
+
*
|
759
|
+
* @scope
|
760
|
+
* @priority 400
|
761
|
+
* @param {string=} onload Expression to evaluate whenever the view updates.
|
762
|
+
*
|
763
|
+
* @param {string=} autoscroll Whether `ngView` should call {@link ng.$anchorScroll
|
764
|
+
* $anchorScroll} to scroll the viewport after the view is updated.
|
765
|
+
*
|
766
|
+
* - If the attribute is not set, disable scrolling.
|
767
|
+
* - If the attribute is set without value, enable scrolling.
|
768
|
+
* - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated
|
769
|
+
* as an expression yields a truthy value.
|
770
|
+
* @example
|
771
|
+
<example name="ngView-directive" module="ngViewExample"
|
772
|
+
deps="angular-route.js;angular-animate.js"
|
773
|
+
animations="true" fixBase="true">
|
774
|
+
<file name="index.html">
|
775
|
+
<div ng-controller="MainCtrl as main">
|
776
|
+
Choose:
|
777
|
+
<a href="Book/Moby">Moby</a> |
|
778
|
+
<a href="Book/Moby/ch/1">Moby: Ch1</a> |
|
779
|
+
<a href="Book/Gatsby">Gatsby</a> |
|
780
|
+
<a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
|
781
|
+
<a href="Book/Scarlet">Scarlet Letter</a><br/>
|
782
|
+
|
783
|
+
<div class="view-animate-container">
|
784
|
+
<div ng-view class="view-animate"></div>
|
785
|
+
</div>
|
786
|
+
<hr />
|
787
|
+
|
788
|
+
<pre>$location.path() = {{main.$location.path()}}</pre>
|
789
|
+
<pre>$route.current.templateUrl = {{main.$route.current.templateUrl}}</pre>
|
790
|
+
<pre>$route.current.params = {{main.$route.current.params}}</pre>
|
791
|
+
<pre>$routeParams = {{main.$routeParams}}</pre>
|
792
|
+
</div>
|
793
|
+
</file>
|
794
|
+
|
795
|
+
<file name="book.html">
|
796
|
+
<div>
|
797
|
+
controller: {{book.name}}<br />
|
798
|
+
Book Id: {{book.params.bookId}}<br />
|
799
|
+
</div>
|
800
|
+
</file>
|
801
|
+
|
802
|
+
<file name="chapter.html">
|
803
|
+
<div>
|
804
|
+
controller: {{chapter.name}}<br />
|
805
|
+
Book Id: {{chapter.params.bookId}}<br />
|
806
|
+
Chapter Id: {{chapter.params.chapterId}}
|
807
|
+
</div>
|
808
|
+
</file>
|
809
|
+
|
810
|
+
<file name="animations.css">
|
811
|
+
.view-animate-container {
|
812
|
+
position:relative;
|
813
|
+
height:100px!important;
|
814
|
+
background:white;
|
815
|
+
border:1px solid black;
|
816
|
+
height:40px;
|
817
|
+
overflow:hidden;
|
818
|
+
}
|
819
|
+
|
820
|
+
.view-animate {
|
821
|
+
padding:10px;
|
822
|
+
}
|
823
|
+
|
824
|
+
.view-animate.ng-enter, .view-animate.ng-leave {
|
825
|
+
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
|
826
|
+
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
|
827
|
+
|
828
|
+
display:block;
|
829
|
+
width:100%;
|
830
|
+
border-left:1px solid black;
|
831
|
+
|
832
|
+
position:absolute;
|
833
|
+
top:0;
|
834
|
+
left:0;
|
835
|
+
right:0;
|
836
|
+
bottom:0;
|
837
|
+
padding:10px;
|
838
|
+
}
|
839
|
+
|
840
|
+
.view-animate.ng-enter {
|
841
|
+
left:100%;
|
842
|
+
}
|
843
|
+
.view-animate.ng-enter.ng-enter-active {
|
844
|
+
left:0;
|
845
|
+
}
|
846
|
+
.view-animate.ng-leave.ng-leave-active {
|
847
|
+
left:-100%;
|
848
|
+
}
|
849
|
+
</file>
|
850
|
+
|
851
|
+
<file name="script.js">
|
852
|
+
angular.module('ngViewExample', ['ngRoute', 'ngAnimate'])
|
853
|
+
.config(['$routeProvider', '$locationProvider',
|
854
|
+
function($routeProvider, $locationProvider) {
|
855
|
+
$routeProvider
|
856
|
+
.when('/Book/:bookId', {
|
857
|
+
templateUrl: 'book.html',
|
858
|
+
controller: 'BookCtrl',
|
859
|
+
controllerAs: 'book'
|
860
|
+
})
|
861
|
+
.when('/Book/:bookId/ch/:chapterId', {
|
862
|
+
templateUrl: 'chapter.html',
|
863
|
+
controller: 'ChapterCtrl',
|
864
|
+
controllerAs: 'chapter'
|
865
|
+
});
|
866
|
+
|
867
|
+
$locationProvider.html5Mode(true);
|
868
|
+
}])
|
869
|
+
.controller('MainCtrl', ['$route', '$routeParams', '$location',
|
870
|
+
function($route, $routeParams, $location) {
|
871
|
+
this.$route = $route;
|
872
|
+
this.$location = $location;
|
873
|
+
this.$routeParams = $routeParams;
|
874
|
+
}])
|
875
|
+
.controller('BookCtrl', ['$routeParams', function($routeParams) {
|
876
|
+
this.name = "BookCtrl";
|
877
|
+
this.params = $routeParams;
|
878
|
+
}])
|
879
|
+
.controller('ChapterCtrl', ['$routeParams', function($routeParams) {
|
880
|
+
this.name = "ChapterCtrl";
|
881
|
+
this.params = $routeParams;
|
882
|
+
}]);
|
883
|
+
|
884
|
+
</file>
|
885
|
+
|
886
|
+
<file name="protractor.js" type="protractor">
|
887
|
+
it('should load and compile correct template', function() {
|
888
|
+
element(by.linkText('Moby: Ch1')).click();
|
889
|
+
var content = element(by.css('[ng-view]')).getText();
|
890
|
+
expect(content).toMatch(/controller\: ChapterCtrl/);
|
891
|
+
expect(content).toMatch(/Book Id\: Moby/);
|
892
|
+
expect(content).toMatch(/Chapter Id\: 1/);
|
893
|
+
|
894
|
+
element(by.partialLinkText('Scarlet')).click();
|
895
|
+
|
896
|
+
content = element(by.css('[ng-view]')).getText();
|
897
|
+
expect(content).toMatch(/controller\: BookCtrl/);
|
898
|
+
expect(content).toMatch(/Book Id\: Scarlet/);
|
899
|
+
});
|
900
|
+
</file>
|
901
|
+
</example>
|
902
|
+
*/
|
903
|
+
|
904
|
+
|
905
|
+
/**
|
906
|
+
* @ngdoc event
|
907
|
+
* @name ngView#$viewContentLoaded
|
908
|
+
* @eventType emit on the current ngView scope
|
909
|
+
* @description
|
910
|
+
* Emitted every time the ngView content is reloaded.
|
911
|
+
*/
|
912
|
+
ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate'];
|
913
|
+
function ngViewFactory($route, $anchorScroll, $animate) {
|
914
|
+
return {
|
915
|
+
restrict: 'ECA',
|
916
|
+
terminal: true,
|
917
|
+
priority: 400,
|
918
|
+
transclude: 'element',
|
919
|
+
link: function(scope, $element, attr, ctrl, $transclude) {
|
920
|
+
var currentScope,
|
921
|
+
currentElement,
|
922
|
+
previousLeaveAnimation,
|
923
|
+
autoScrollExp = attr.autoscroll,
|
924
|
+
onloadExp = attr.onload || '';
|
925
|
+
|
926
|
+
scope.$on('$routeChangeSuccess', update);
|
927
|
+
update();
|
928
|
+
|
929
|
+
function cleanupLastView() {
|
930
|
+
if (previousLeaveAnimation) {
|
931
|
+
$animate.cancel(previousLeaveAnimation);
|
932
|
+
previousLeaveAnimation = null;
|
933
|
+
}
|
934
|
+
|
935
|
+
if (currentScope) {
|
936
|
+
currentScope.$destroy();
|
937
|
+
currentScope = null;
|
938
|
+
}
|
939
|
+
if (currentElement) {
|
940
|
+
previousLeaveAnimation = $animate.leave(currentElement);
|
941
|
+
previousLeaveAnimation.then(function() {
|
942
|
+
previousLeaveAnimation = null;
|
943
|
+
});
|
944
|
+
currentElement = null;
|
945
|
+
}
|
946
|
+
}
|
947
|
+
|
948
|
+
function update() {
|
949
|
+
var locals = $route.current && $route.current.locals,
|
950
|
+
template = locals && locals.$template;
|
951
|
+
|
952
|
+
if (angular.isDefined(template)) {
|
953
|
+
var newScope = scope.$new();
|
954
|
+
var current = $route.current;
|
955
|
+
|
956
|
+
// Note: This will also link all children of ng-view that were contained in the original
|
957
|
+
// html. If that content contains controllers, ... they could pollute/change the scope.
|
958
|
+
// However, using ng-view on an element with additional content does not make sense...
|
959
|
+
// Note: We can't remove them in the cloneAttchFn of $transclude as that
|
960
|
+
// function is called before linking the content, which would apply child
|
961
|
+
// directives to non existing elements.
|
962
|
+
var clone = $transclude(newScope, function(clone) {
|
963
|
+
$animate.enter(clone, null, currentElement || $element).then(function onNgViewEnter() {
|
964
|
+
if (angular.isDefined(autoScrollExp)
|
965
|
+
&& (!autoScrollExp || scope.$eval(autoScrollExp))) {
|
966
|
+
$anchorScroll();
|
967
|
+
}
|
968
|
+
});
|
969
|
+
cleanupLastView();
|
970
|
+
});
|
971
|
+
|
972
|
+
currentElement = clone;
|
973
|
+
currentScope = current.scope = newScope;
|
974
|
+
currentScope.$emit('$viewContentLoaded');
|
975
|
+
currentScope.$eval(onloadExp);
|
976
|
+
} else {
|
977
|
+
cleanupLastView();
|
978
|
+
}
|
979
|
+
}
|
980
|
+
}
|
981
|
+
};
|
982
|
+
}
|
983
|
+
|
984
|
+
// This directive is called during the $transclude call of the first `ngView` directive.
|
985
|
+
// It will replace and compile the content of the element with the loaded template.
|
986
|
+
// We need this directive so that the element content is already filled when
|
987
|
+
// the link function of another directive on the same element as ngView
|
988
|
+
// is called.
|
989
|
+
ngViewFillContentFactory.$inject = ['$compile', '$controller', '$route'];
|
990
|
+
function ngViewFillContentFactory($compile, $controller, $route) {
|
991
|
+
return {
|
992
|
+
restrict: 'ECA',
|
993
|
+
priority: -400,
|
994
|
+
link: function(scope, $element) {
|
995
|
+
var current = $route.current,
|
996
|
+
locals = current.locals;
|
997
|
+
|
998
|
+
$element.html(locals.$template);
|
999
|
+
|
1000
|
+
var link = $compile($element.contents());
|
1001
|
+
|
1002
|
+
if (current.controller) {
|
1003
|
+
locals.$scope = scope;
|
1004
|
+
var controller = $controller(current.controller, locals);
|
1005
|
+
if (current.controllerAs) {
|
1006
|
+
scope[current.controllerAs] = controller;
|
1007
|
+
}
|
1008
|
+
$element.data('$ngControllerController', controller);
|
1009
|
+
$element.children().data('$ngControllerController', controller);
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
link(scope);
|
1013
|
+
}
|
1014
|
+
};
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
|
1018
|
+
})(window, window.angular);
|