55 | * $scope.$on('$viewContentLoading',
56 | * function(event, viewConfig){
57 | * // Access to all the view config properties.
58 | * // and one special property 'targetView'
59 | * // viewConfig.targetView
60 | * });
61 | *
62 | */
63 | $rootScope.$broadcast('$viewContentLoading', options);
64 | }
65 | return result;
66 | }
67 | };
68 | }
69 | }
70 |
71 | angular.module('ui.router.state').provider('$view', $ViewProvider);
72 |
--------------------------------------------------------------------------------
/example/public/components/pusher-angular/lib/pusher-angular.min.js:
--------------------------------------------------------------------------------
1 | "use strict";angular.module("pusher-angular",[]).factory("$pusher",["$rootScope","$channel","$connection",function(n,e,t){function i(n){if(!(this instanceof i)){return new i(n)}this._assertValidClient(n);this.client=n;this.connection=t(n.connection,n);this.channels={}}i.prototype={subscribe:function(n){var t=this.client.channel(n);if(t===undefined){t=this.client.subscribe(n)}t=e(t,this);this.channels[n]=t;return t},unsubscribe:function(n){if(this.client.channel(n)){this.client.unsubscribe(n);if(this.channels[n]){delete this.channels[n]}}},bind:function(e,t){this.client.bind(e,function(e){t(e);n.$digest()})},bind_all:function(e){this.client.bind_all(function(t,i){e(t,i);n.$digest()})},unbind:function(n,e){this.client.unbind(n,e)},disconnect:function(){this.client.disconnect()},channel:function(n){return this.channels[n]},allChannels:function(){return this.channels},_assertValidClient:function(n){if(!angular.isObject(n)||!angular.isObject(n.connection)||typeof n.channel!=="function"){throw new Error("Invalid Pusher client object")}}};return i}]).factory("$channel",["$rootScope","$members",function(n,e){function t(n){if(n.indexOf("presence-")==-1&&n.indexOf("private-")==-1){throw new Error("Presence or private channel required")}}function i(n,t){if(!(this instanceof i)){return new i(n,t)}this._assertValidChannel(n);this.baseChannel=n;this.client=t;this.name=n.name;if(n.name.indexOf("presence")==-1){this.members=function(){throw new Error("Members object only exists for presence channels")}}else{this.members=e(n.members,n)}}i.prototype={bind:function(e,t,i){this.baseChannel.bind(e,function(e){t(e);n.$digest()},i)},unbind:function(n,e,t){this.baseChannel.unbind(n,e,t)},bind_all:function(e){this.baseChannel.bind_all(function(t,i){e(t,i);n.$digest()})},trigger:function(n,e){t(this.name);if(n.indexOf("client-")==-1){throw new Error("Event name requires 'client-' prefix")}return this.baseChannel.trigger(n,e)},_assertValidChannel:function(n){if(!angular.isObject(n)||typeof n.name!=="string"){throw new Error("Invalid Pusher channel object")}}};return i}]).factory("$members",["$rootScope",function(n){function e(t,i){if(!(this instanceof e)){return new e(t,i)}var s=this;this._assertValidMembers(t);this.baseMembers=t;this.baseChannel=i;this.me={};this.count=0;this.members={};i.bind("pusher:subscription_succeeded",function(e){s.me=e.me;s.count=e.count;s.members=e.members;n.$digest()});i.bind("pusher:member_added",function(e){s.count++;if(e.info){s.members[e.id.toString()]=e.info}else{s.members[e.id.toString()]=null}n.$digest()});i.bind("pusher:member_removed",function(e){s.count--;delete s.members[e.id.toString()];n.$digest()})}e.prototype={get:function(n){return this.baseMembers.get(n)},each:function(e){this.baseMembers.each(function(t){e(t);n.$digest()})},_assertValidMembers:function(n){if(!angular.isObject(n)||typeof n.me!=="object"){throw new Error("Invalid Pusher channel members object")}}};return e}]).factory("$connection",["$rootScope",function(n){function e(n,t){if(!(this instanceof e)){return new e(n,t)}this._assertValidConnection(n);this.baseConnection=n;this.baseClient=t}e.prototype={bind:function(e,t,i){this.baseConnection.bind(e,function(e){t(e);n.$digest()},i)},bind_all:function(e){this.baseConnection.bind_all(function(t,i){e(t,i);n.$digest()})},_assertValidConnection:function(n){if(!angular.isObject(n)){throw new Error("Invalid Pusher connection object")}}};return e}]);
--------------------------------------------------------------------------------
/lib/pusher-angular.min.js:
--------------------------------------------------------------------------------
1 | "use strict";angular.module("pusher-angular",[]).factory("$pusher",["$rootScope","$channel","$connection",function(n,e,i){function t(n){if(!(this instanceof t)){return new t(n)}this._assertValidClient(n);this.client=n;this.connection=i(n.connection,n);this.channels={}}t.prototype={subscribe:function(n){var i=this.client.channel(n);if(i===undefined){i=this.client.subscribe(n)}i=e(i,this);this.channels[n]=i;return i},unsubscribe:function(n){if(this.client.channel(n)){this.client.unsubscribe(n);if(this.channels[n]){delete this.channels[n]}}},bind:function(e,i,t,s){var r=angular.isDefined(s)&&!s,o=function(e){i(e);if(!r)n.$digest()};this.client.bind(e,o,t);return o},bind_global:function(e,i){var t=angular.isDefined(i)&&!i;this.client.bind_global(function(i,s){e(i,s);if(!t)n.$digest()})},unbind:function(n,e,i){this.client.unbind(n,e,i)},disconnect:function(){this.client.disconnect()},channel:function(n){return this.channels[n]},allChannels:function(){return this.channels},_assertValidClient:function(n){if(!angular.isObject(n)||!angular.isObject(n.connection)||typeof n.channel!=="function"){throw new Error("Invalid Pusher client object")}}};return t}]).factory("$channel",["$rootScope","$members",function(n,e){function i(n){if(n.indexOf("presence-")==-1&&n.indexOf("private-")==-1){throw new Error("Presence or private channel required")}}function t(n,i){if(!(this instanceof t)){return new t(n,i)}this._assertValidChannel(n);this.baseChannel=n;this.client=i;this.name=n.name;if(n.name.indexOf("presence")==-1){this.members=function(){throw new Error("Members object only exists for presence channels")}}else{this.members=e(n.members,n)}}t.prototype={bind:function(e,i,t,s){var r=angular.isDefined(s)&&!s,o=function(e){i(e);if(!r)n.$digest()};this.baseChannel.bind(e,o,t);return o},unbind:function(n,e,i){this.baseChannel.unbind(n,e,i)},bind_global:function(e,i){var t=angular.isDefined(i)&&!i;this.baseChannel.bind_global(function(i,s){e(i,s);if(!t)n.$digest()})},trigger:function(n,e){i(this.name);if(n.indexOf("client-")==-1){throw new Error("Event name requires 'client-' prefix")}return this.baseChannel.trigger(n,e)},_assertValidChannel:function(n){if(!angular.isObject(n)||typeof n.name!=="string"){throw new Error("Invalid Pusher channel object")}}};return t}]).factory("$members",["$rootScope",function(n){function e(i,t){if(!(this instanceof e)){return new e(i,t)}var s=this;this._assertValidMembers(i);this.baseMembers=i;this.baseChannel=t;this.me={};this.count=0;this.members={};t.bind("pusher:subscription_succeeded",function(e){s.me=e.me;s.count=e.count;s.members=e.members;n.$digest()});t.bind("pusher:member_added",function(e){s.count++;if(e.info){s.members[e.id.toString()]=e.info}else{s.members[e.id.toString()]=null}n.$digest()});t.bind("pusher:member_removed",function(e){s.count--;delete s.members[e.id.toString()];n.$digest()})}e.prototype={get:function(n){return this.baseMembers.get(n)},each:function(e){this.baseMembers.each(function(i){e(i);n.$digest()})},_assertValidMembers:function(n){if(!angular.isObject(n)||typeof n.me!=="object"){throw new Error("Invalid Pusher channel members object")}}};return e}]).factory("$connection",["$rootScope",function(n){function e(n,i){if(!(this instanceof e)){return new e(n,i)}this._assertValidConnection(n);this.baseConnection=n;this.baseClient=i}e.prototype={bind:function(e,i,t,s){var r=angular.isDefined(s)&&!s;this.baseConnection.bind(e,function(e){i(e);if(!r)n.$digest()},t)},bind_global:function(e,i){var t=angular.isDefined(i)&&!i;this.baseConnection.bind_global(function(i,s){e(i,s);if(!t)n.$digest()})},_assertValidConnection:function(n){if(!angular.isObject(n)){throw new Error("Invalid Pusher connection object")}}};return e}]);
--------------------------------------------------------------------------------
/example/public/components/ui-router/src/templateFactory.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @ngdoc object
3 | * @name ui.router.util.$templateFactory
4 | *
5 | * @requires $http
6 | * @requires $templateCache
7 | * @requires $injector
8 | *
9 | * @description
10 | * Service. Manages loading of templates.
11 | */
12 | $TemplateFactory.$inject = ['$http', '$templateCache', '$injector'];
13 | function $TemplateFactory( $http, $templateCache, $injector) {
14 |
15 | /**
16 | * @ngdoc function
17 | * @name ui.router.util.$templateFactory#fromConfig
18 | * @methodOf ui.router.util.$templateFactory
19 | *
20 | * @description
21 | * Creates a template from a configuration object.
22 | *
23 | * @param {object} config Configuration object for which to load a template.
24 | * The following properties are search in the specified order, and the first one
25 | * that is defined is used to create the template:
26 | *
27 | * @param {string|object} config.template html string template or function to
28 | * load via {@link ui.router.util.$templateFactory#fromString fromString}.
29 | * @param {string|object} config.templateUrl url to load or a function returning
30 | * the url to load via {@link ui.router.util.$templateFactory#fromUrl fromUrl}.
31 | * @param {Function} config.templateProvider function to invoke via
32 | * {@link ui.router.util.$templateFactory#fromProvider fromProvider}.
33 | * @param {object} params Parameters to pass to the template function.
34 | * @param {object} locals Locals to pass to `invoke` if the template is loaded
35 | * via a `templateProvider`. Defaults to `{ params: params }`.
36 | *
37 | * @return {string|object} The template html as a string, or a promise for
38 | * that string,or `null` if no template is configured.
39 | */
40 | this.fromConfig = function (config, params, locals) {
41 | return (
42 | isDefined(config.template) ? this.fromString(config.template, params) :
43 | isDefined(config.templateUrl) ? this.fromUrl(config.templateUrl, params) :
44 | isDefined(config.templateProvider) ? this.fromProvider(config.templateProvider, params, locals) :
45 | null
46 | );
47 | };
48 |
49 | /**
50 | * @ngdoc function
51 | * @name ui.router.util.$templateFactory#fromString
52 | * @methodOf ui.router.util.$templateFactory
53 | *
54 | * @description
55 | * Creates a template from a string or a function returning a string.
56 | *
57 | * @param {string|object} template html template as a string or function that
58 | * returns an html template as a string.
59 | * @param {object} params Parameters to pass to the template function.
60 | *
61 | * @return {string|object} The template html as a string, or a promise for that
62 | * string.
63 | */
64 | this.fromString = function (template, params) {
65 | return isFunction(template) ? template(params) : template;
66 | };
67 |
68 | /**
69 | * @ngdoc function
70 | * @name ui.router.util.$templateFactory#fromUrl
71 | * @methodOf ui.router.util.$templateFactory
72 | *
73 | * @description
74 | * Loads a template from the a URL via `$http` and `$templateCache`.
75 | *
76 | * @param {string|Function} url url of the template to load, or a function
77 | * that returns a url.
78 | * @param {Object} params Parameters to pass to the url function.
79 | * @return {string|Promise.} The template html as a string, or a promise
80 | * for that string.
81 | */
82 | this.fromUrl = function (url, params) {
83 | if (isFunction(url)) url = url(params);
84 | if (url == null) return null;
85 | else return $http
86 | .get(url, { cache: $templateCache })
87 | .then(function(response) { return response.data; });
88 | };
89 |
90 | /**
91 | * @ngdoc function
92 | * @name ui.router.util.$templateFactory#fromProvider
93 | * @methodOf ui.router.util.$templateFactory
94 | *
95 | * @description
96 | * Creates a template by invoking an injectable provider function.
97 | *
98 | * @param {Function} provider Function to invoke via `$injector.invoke`
99 | * @param {Object} params Parameters for the template.
100 | * @param {Object} locals Locals to pass to `invoke`. Defaults to
101 | * `{ params: params }`.
102 | * @return {string|Promise.} The template html as a string, or a promise
103 | * for that string.
104 | */
105 | this.fromProvider = function (provider, params, locals) {
106 | return $injector.invoke(provider, null, locals || { params: params });
107 | };
108 | }
109 |
110 | angular.module('ui.router.util').service('$templateFactory', $TemplateFactory);
111 |
--------------------------------------------------------------------------------
/example/public/components/pusher-angular/example/public/components/ui-router/src/templateFactory.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @ngdoc object
3 | * @name ui.router.util.$templateFactory
4 | *
5 | * @requires $http
6 | * @requires $templateCache
7 | * @requires $injector
8 | *
9 | * @description
10 | * Service. Manages loading of templates.
11 | */
12 | $TemplateFactory.$inject = ['$http', '$templateCache', '$injector'];
13 | function $TemplateFactory( $http, $templateCache, $injector) {
14 |
15 | /**
16 | * @ngdoc function
17 | * @name ui.router.util.$templateFactory#fromConfig
18 | * @methodOf ui.router.util.$templateFactory
19 | *
20 | * @description
21 | * Creates a template from a configuration object.
22 | *
23 | * @param {object} config Configuration object for which to load a template.
24 | * The following properties are search in the specified order, and the first one
25 | * that is defined is used to create the template:
26 | *
27 | * @param {string|object} config.template html string template or function to
28 | * load via {@link ui.router.util.$templateFactory#fromString fromString}.
29 | * @param {string|object} config.templateUrl url to load or a function returning
30 | * the url to load via {@link ui.router.util.$templateFactory#fromUrl fromUrl}.
31 | * @param {Function} config.templateProvider function to invoke via
32 | * {@link ui.router.util.$templateFactory#fromProvider fromProvider}.
33 | * @param {object} params Parameters to pass to the template function.
34 | * @param {object} locals Locals to pass to `invoke` if the template is loaded
35 | * via a `templateProvider`. Defaults to `{ params: params }`.
36 | *
37 | * @return {string|object} The template html as a string, or a promise for
38 | * that string,or `null` if no template is configured.
39 | */
40 | this.fromConfig = function (config, params, locals) {
41 | return (
42 | isDefined(config.template) ? this.fromString(config.template, params) :
43 | isDefined(config.templateUrl) ? this.fromUrl(config.templateUrl, params) :
44 | isDefined(config.templateProvider) ? this.fromProvider(config.templateProvider, params, locals) :
45 | null
46 | );
47 | };
48 |
49 | /**
50 | * @ngdoc function
51 | * @name ui.router.util.$templateFactory#fromString
52 | * @methodOf ui.router.util.$templateFactory
53 | *
54 | * @description
55 | * Creates a template from a string or a function returning a string.
56 | *
57 | * @param {string|object} template html template as a string or function that
58 | * returns an html template as a string.
59 | * @param {object} params Parameters to pass to the template function.
60 | *
61 | * @return {string|object} The template html as a string, or a promise for that
62 | * string.
63 | */
64 | this.fromString = function (template, params) {
65 | return isFunction(template) ? template(params) : template;
66 | };
67 |
68 | /**
69 | * @ngdoc function
70 | * @name ui.router.util.$templateFactory#fromUrl
71 | * @methodOf ui.router.util.$templateFactory
72 | *
73 | * @description
74 | * Loads a template from the a URL via `$http` and `$templateCache`.
75 | *
76 | * @param {string|Function} url url of the template to load, or a function
77 | * that returns a url.
78 | * @param {Object} params Parameters to pass to the url function.
79 | * @return {string|Promise.} The template html as a string, or a promise
80 | * for that string.
81 | */
82 | this.fromUrl = function (url, params) {
83 | if (isFunction(url)) url = url(params);
84 | if (url == null) return null;
85 | else return $http
86 | .get(url, { cache: $templateCache })
87 | .then(function(response) { return response.data; });
88 | };
89 |
90 | /**
91 | * @ngdoc function
92 | * @name ui.router.util.$templateFactory#fromProvider
93 | * @methodOf ui.router.util.$templateFactory
94 | *
95 | * @description
96 | * Creates a template by invoking an injectable provider function.
97 | *
98 | * @param {Function} provider Function to invoke via `$injector.invoke`
99 | * @param {Object} params Parameters for the template.
100 | * @param {Object} locals Locals to pass to `invoke`. Defaults to
101 | * `{ params: params }`.
102 | * @return {string|Promise.} The template html as a string, or a promise
103 | * for that string.
104 | */
105 | this.fromProvider = function (provider, params, locals) {
106 | return $injector.invoke(provider, null, locals || { params: params });
107 | };
108 | }
109 |
110 | angular.module('ui.router.util').service('$templateFactory', $TemplateFactory);
111 |
--------------------------------------------------------------------------------
/example/public/components/ui-router/api/angular-ui-router.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for Angular JS 1.1.5+ (ui.router module)
2 | // Project: https://github.com/angular-ui/ui-router
3 | // Definitions by: Michel Salib
4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
5 |
6 | declare module ng.ui {
7 |
8 | interface IState {
9 | name?: string;
10 | template?: string;
11 | templateUrl?: any; // string || () => string
12 | templateProvider?: any; // () => string || IPromise
13 | controller?: any;
14 | controllerAs?: string;
15 | controllerProvider?: any;
16 | resolve?: {};
17 | url?: string;
18 | params?: any[];
19 | views?: {};
20 | abstract?: boolean;
21 | onEnter?: (...args: any[]) => void;
22 | onExit?: (...args: any[]) => void;
23 | data?: any;
24 | }
25 |
26 | interface ITypedState {
27 | name?: string;
28 | template?: string;
29 | templateUrl?: string;
30 | templateProvider?: () => string;
31 | controller?: any;
32 | controllerAs?: string;
33 | controllerProvider?: any;
34 | resolve?: {};
35 | url?: string;
36 | params?: any[];
37 | views?: {};
38 | abstract?: boolean;
39 | onEnter?: (...args: any[]) => void;
40 | onExit?: (...args: any[]) => void;
41 | data?: T;
42 | }
43 |
44 | interface IStateProvider extends IServiceProvider {
45 | state(name: string, config: IState): IStateProvider;
46 | state(config: IState): IStateProvider;
47 | decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any;
48 | }
49 |
50 | interface IUrlMatcher {
51 | concat(pattern: string): IUrlMatcher;
52 | exec(path: string, searchParams: {}): {};
53 | parameters(): string[];
54 | format(values: {}): string;
55 | }
56 |
57 | interface IUrlMatcherFactory {
58 | compile(pattern: string): IUrlMatcher;
59 | isMatcher(o: any): boolean;
60 | }
61 |
62 | interface IUrlRouterProvider extends IServiceProvider {
63 | when(whenPath: RegExp, handler: Function): IUrlRouterProvider;
64 | when(whenPath: RegExp, handler: any[]): IUrlRouterProvider;
65 | when(whenPath: RegExp, toPath: string): IUrlRouterProvider;
66 | when(whenPath: IUrlMatcher, hanlder: Function): IUrlRouterProvider;
67 | when(whenPath: IUrlMatcher, handler: any[]): IUrlRouterProvider;
68 | when(whenPath: IUrlMatcher, toPath: string): IUrlRouterProvider;
69 | when(whenPath: string, handler: Function): IUrlRouterProvider;
70 | when(whenPath: string, handler: any[]): IUrlRouterProvider;
71 | when(whenPath: string, toPath: string): IUrlRouterProvider;
72 | otherwise(handler: Function): IUrlRouterProvider;
73 | otherwise(handler: any[]): IUrlRouterProvider;
74 | otherwise(path: string): IUrlRouterProvider;
75 | rule(handler: Function): IUrlRouterProvider;
76 | rule(handler: any[]): IUrlRouterProvider;
77 | }
78 |
79 | interface IStateOptions {
80 | location?: any;
81 | inherit?: boolean;
82 | relative?: IState;
83 | notify?: boolean;
84 | }
85 |
86 | interface IHrefOptions {
87 | lossy?: boolean;
88 | inherit?: boolean;
89 | relative?: IState;
90 | absolute?: boolean;
91 | }
92 |
93 | interface IStateService {
94 | go(to: string, params?: {}, options?: IStateOptions): IPromise;
95 | transitionTo(state: string, params?: {}, updateLocation?: boolean): void;
96 | transitionTo(state: string, params?: {}, options?: IStateOptions): void;
97 | includes(state: string, params?: {}): boolean;
98 | is(state:string, params?: {}): boolean;
99 | is(state: IState, params?: {}): boolean;
100 | href(state: IState, params?: {}, options?: IHrefOptions): string;
101 | href(state: string, params?: {}, options?: IHrefOptions): string;
102 | get(state: string): IState;
103 | get(): IState[];
104 | current: IState;
105 | params: any;
106 | reload(): void;
107 | }
108 |
109 | interface IStateParamsService {
110 | [key: string]: any;
111 | }
112 |
113 | interface IStateParams {
114 | [key: string]: any;
115 | }
116 |
117 | interface IUrlRouterService {
118 | /*
119 | * Triggers an update; the same update that happens when the address bar
120 | * url changes, aka $locationChangeSuccess.
121 | *
122 | * This method is useful when you need to use preventDefault() on the
123 | * $locationChangeSuccess event, perform some custom logic (route protection,
124 | * auth, config, redirection, etc) and then finally proceed with the transition
125 | * by calling $urlRouter.sync().
126 | *
127 | */
128 | sync(): void;
129 | }
130 |
131 | interface IUiViewScrollProvider {
132 | /*
133 | * Reverts back to using the core $anchorScroll service for scrolling
134 | * based on the url anchor.
135 | */
136 | useAnchorScroll(): void;
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/example/public/components/pusher-angular/example/public/components/ui-router/api/angular-ui-router.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for Angular JS 1.1.5+ (ui.router module)
2 | // Project: https://github.com/angular-ui/ui-router
3 | // Definitions by: Michel Salib
4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
5 |
6 | declare module ng.ui {
7 |
8 | interface IState {
9 | name?: string;
10 | template?: string;
11 | templateUrl?: any; // string || () => string
12 | templateProvider?: any; // () => string || IPromise
13 | controller?: any;
14 | controllerAs?: string;
15 | controllerProvider?: any;
16 | resolve?: {};
17 | url?: string;
18 | params?: any[];
19 | views?: {};
20 | abstract?: boolean;
21 | onEnter?: (...args: any[]) => void;
22 | onExit?: (...args: any[]) => void;
23 | data?: any;
24 | }
25 |
26 | interface ITypedState {
27 | name?: string;
28 | template?: string;
29 | templateUrl?: string;
30 | templateProvider?: () => string;
31 | controller?: any;
32 | controllerAs?: string;
33 | controllerProvider?: any;
34 | resolve?: {};
35 | url?: string;
36 | params?: any[];
37 | views?: {};
38 | abstract?: boolean;
39 | onEnter?: (...args: any[]) => void;
40 | onExit?: (...args: any[]) => void;
41 | data?: T;
42 | }
43 |
44 | interface IStateProvider extends IServiceProvider {
45 | state(name: string, config: IState): IStateProvider;
46 | state(config: IState): IStateProvider;
47 | decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any;
48 | }
49 |
50 | interface IUrlMatcher {
51 | concat(pattern: string): IUrlMatcher;
52 | exec(path: string, searchParams: {}): {};
53 | parameters(): string[];
54 | format(values: {}): string;
55 | }
56 |
57 | interface IUrlMatcherFactory {
58 | compile(pattern: string): IUrlMatcher;
59 | isMatcher(o: any): boolean;
60 | }
61 |
62 | interface IUrlRouterProvider extends IServiceProvider {
63 | when(whenPath: RegExp, handler: Function): IUrlRouterProvider;
64 | when(whenPath: RegExp, handler: any[]): IUrlRouterProvider;
65 | when(whenPath: RegExp, toPath: string): IUrlRouterProvider;
66 | when(whenPath: IUrlMatcher, hanlder: Function): IUrlRouterProvider;
67 | when(whenPath: IUrlMatcher, handler: any[]): IUrlRouterProvider;
68 | when(whenPath: IUrlMatcher, toPath: string): IUrlRouterProvider;
69 | when(whenPath: string, handler: Function): IUrlRouterProvider;
70 | when(whenPath: string, handler: any[]): IUrlRouterProvider;
71 | when(whenPath: string, toPath: string): IUrlRouterProvider;
72 | otherwise(handler: Function): IUrlRouterProvider;
73 | otherwise(handler: any[]): IUrlRouterProvider;
74 | otherwise(path: string): IUrlRouterProvider;
75 | rule(handler: Function): IUrlRouterProvider;
76 | rule(handler: any[]): IUrlRouterProvider;
77 | }
78 |
79 | interface IStateOptions {
80 | location?: any;
81 | inherit?: boolean;
82 | relative?: IState;
83 | notify?: boolean;
84 | }
85 |
86 | interface IHrefOptions {
87 | lossy?: boolean;
88 | inherit?: boolean;
89 | relative?: IState;
90 | absolute?: boolean;
91 | }
92 |
93 | interface IStateService {
94 | go(to: string, params?: {}, options?: IStateOptions): IPromise;
95 | transitionTo(state: string, params?: {}, updateLocation?: boolean): void;
96 | transitionTo(state: string, params?: {}, options?: IStateOptions): void;
97 | includes(state: string, params?: {}): boolean;
98 | is(state:string, params?: {}): boolean;
99 | is(state: IState, params?: {}): boolean;
100 | href(state: IState, params?: {}, options?: IHrefOptions): string;
101 | href(state: string, params?: {}, options?: IHrefOptions): string;
102 | get(state: string): IState;
103 | get(): IState[];
104 | current: IState;
105 | params: any;
106 | reload(): void;
107 | }
108 |
109 | interface IStateParamsService {
110 | [key: string]: any;
111 | }
112 |
113 | interface IStateParams {
114 | [key: string]: any;
115 | }
116 |
117 | interface IUrlRouterService {
118 | /*
119 | * Triggers an update; the same update that happens when the address bar
120 | * url changes, aka $locationChangeSuccess.
121 | *
122 | * This method is useful when you need to use preventDefault() on the
123 | * $locationChangeSuccess event, perform some custom logic (route protection,
124 | * auth, config, redirection, etc) and then finally proceed with the transition
125 | * by calling $urlRouter.sync().
126 | *
127 | */
128 | sync(): void;
129 | }
130 |
131 | interface IUiViewScrollProvider {
132 | /*
133 | * Reverts back to using the core $anchorScroll service for scrolling
134 | * based on the url anchor.
135 | */
136 | useAnchorScroll(): void;
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/example/public/components/ui-router/src/common.js:
--------------------------------------------------------------------------------
1 | /*jshint globalstrict:true*/
2 | /*global angular:false*/
3 | 'use strict';
4 |
5 | var isDefined = angular.isDefined,
6 | isFunction = angular.isFunction,
7 | isString = angular.isString,
8 | isObject = angular.isObject,
9 | isArray = angular.isArray,
10 | forEach = angular.forEach,
11 | extend = angular.extend,
12 | copy = angular.copy;
13 |
14 | function inherit(parent, extra) {
15 | return extend(new (extend(function() {}, { prototype: parent }))(), extra);
16 | }
17 |
18 | function merge(dst) {
19 | forEach(arguments, function(obj) {
20 | if (obj !== dst) {
21 | forEach(obj, function(value, key) {
22 | if (!dst.hasOwnProperty(key)) dst[key] = value;
23 | });
24 | }
25 | });
26 | return dst;
27 | }
28 |
29 | /**
30 | * Finds the common ancestor path between two states.
31 | *
32 | * @param {Object} first The first state.
33 | * @param {Object} second The second state.
34 | * @return {Array} Returns an array of state names in descending order, not including the root.
35 | */
36 | function ancestors(first, second) {
37 | var path = [];
38 |
39 | for (var n in first.path) {
40 | if (first.path[n] !== second.path[n]) break;
41 | path.push(first.path[n]);
42 | }
43 | return path;
44 | }
45 |
46 | /**
47 | * IE8-safe wrapper for `Object.keys()`.
48 | *
49 | * @param {Object} object A JavaScript object.
50 | * @return {Array} Returns the keys of the object as an array.
51 | */
52 | function objectKeys(object) {
53 | if (Object.keys) {
54 | return Object.keys(object);
55 | }
56 | var result = [];
57 |
58 | angular.forEach(object, function(val, key) {
59 | result.push(key);
60 | });
61 | return result;
62 | }
63 |
64 | /**
65 | * IE8-safe wrapper for `Array.prototype.indexOf()`.
66 | *
67 | * @param {Array} array A JavaScript array.
68 | * @param {*} value A value to search the array for.
69 | * @return {Number} Returns the array index value of `value`, or `-1` if not present.
70 | */
71 | function arraySearch(array, value) {
72 | if (Array.prototype.indexOf) {
73 | return array.indexOf(value, Number(arguments[2]) || 0);
74 | }
75 | var len = array.length >>> 0, from = Number(arguments[2]) || 0;
76 | from = (from < 0) ? Math.ceil(from) : Math.floor(from);
77 |
78 | if (from < 0) from += len;
79 |
80 | for (; from < len; from++) {
81 | if (from in array && array[from] === value) return from;
82 | }
83 | return -1;
84 | }
85 |
86 | /**
87 | * Merges a set of parameters with all parameters inherited between the common parents of the
88 | * current state and a given destination state.
89 | *
90 | * @param {Object} currentParams The value of the current state parameters ($stateParams).
91 | * @param {Object} newParams The set of parameters which will be composited with inherited params.
92 | * @param {Object} $current Internal definition of object representing the current state.
93 | * @param {Object} $to Internal definition of object representing state to transition to.
94 | */
95 | function inheritParams(currentParams, newParams, $current, $to) {
96 | var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];
97 |
98 | for (var i in parents) {
99 | if (!parents[i].params) continue;
100 | parentParams = objectKeys(parents[i].params);
101 | if (!parentParams.length) continue;
102 |
103 | for (var j in parentParams) {
104 | if (arraySearch(inheritList, parentParams[j]) >= 0) continue;
105 | inheritList.push(parentParams[j]);
106 | inherited[parentParams[j]] = currentParams[parentParams[j]];
107 | }
108 | }
109 | return extend({}, inherited, newParams);
110 | }
111 |
112 | /**
113 | * Performs a non-strict comparison of the subset of two objects, defined by a list of keys.
114 | *
115 | * @param {Object} a The first object.
116 | * @param {Object} b The second object.
117 | * @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,
118 | * it defaults to the list of keys in `a`.
119 | * @return {Boolean} Returns `true` if the keys match, otherwise `false`.
120 | */
121 | function equalForKeys(a, b, keys) {
122 | if (!keys) {
123 | keys = [];
124 | for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility
125 | }
126 |
127 | for (var i=0; i
212 | *
213 | *
214 | *
215 | *
216 | *
217 | *
218 | *
222 | *
223 | *
224 | *
225 | *
226 | *
227 | */
228 | angular.module('ui.router', ['ui.router.state']);
229 |
230 | angular.module('ui.router.compat', ['ui.router']);
231 |
--------------------------------------------------------------------------------
/example/public/components/pusher-angular/example/public/components/ui-router/src/common.js:
--------------------------------------------------------------------------------
1 | /*jshint globalstrict:true*/
2 | /*global angular:false*/
3 | 'use strict';
4 |
5 | var isDefined = angular.isDefined,
6 | isFunction = angular.isFunction,
7 | isString = angular.isString,
8 | isObject = angular.isObject,
9 | isArray = angular.isArray,
10 | forEach = angular.forEach,
11 | extend = angular.extend,
12 | copy = angular.copy;
13 |
14 | function inherit(parent, extra) {
15 | return extend(new (extend(function() {}, { prototype: parent }))(), extra);
16 | }
17 |
18 | function merge(dst) {
19 | forEach(arguments, function(obj) {
20 | if (obj !== dst) {
21 | forEach(obj, function(value, key) {
22 | if (!dst.hasOwnProperty(key)) dst[key] = value;
23 | });
24 | }
25 | });
26 | return dst;
27 | }
28 |
29 | /**
30 | * Finds the common ancestor path between two states.
31 | *
32 | * @param {Object} first The first state.
33 | * @param {Object} second The second state.
34 | * @return {Array} Returns an array of state names in descending order, not including the root.
35 | */
36 | function ancestors(first, second) {
37 | var path = [];
38 |
39 | for (var n in first.path) {
40 | if (first.path[n] !== second.path[n]) break;
41 | path.push(first.path[n]);
42 | }
43 | return path;
44 | }
45 |
46 | /**
47 | * IE8-safe wrapper for `Object.keys()`.
48 | *
49 | * @param {Object} object A JavaScript object.
50 | * @return {Array} Returns the keys of the object as an array.
51 | */
52 | function objectKeys(object) {
53 | if (Object.keys) {
54 | return Object.keys(object);
55 | }
56 | var result = [];
57 |
58 | angular.forEach(object, function(val, key) {
59 | result.push(key);
60 | });
61 | return result;
62 | }
63 |
64 | /**
65 | * IE8-safe wrapper for `Array.prototype.indexOf()`.
66 | *
67 | * @param {Array} array A JavaScript array.
68 | * @param {*} value A value to search the array for.
69 | * @return {Number} Returns the array index value of `value`, or `-1` if not present.
70 | */
71 | function arraySearch(array, value) {
72 | if (Array.prototype.indexOf) {
73 | return array.indexOf(value, Number(arguments[2]) || 0);
74 | }
75 | var len = array.length >>> 0, from = Number(arguments[2]) || 0;
76 | from = (from < 0) ? Math.ceil(from) : Math.floor(from);
77 |
78 | if (from < 0) from += len;
79 |
80 | for (; from < len; from++) {
81 | if (from in array && array[from] === value) return from;
82 | }
83 | return -1;
84 | }
85 |
86 | /**
87 | * Merges a set of parameters with all parameters inherited between the common parents of the
88 | * current state and a given destination state.
89 | *
90 | * @param {Object} currentParams The value of the current state parameters ($stateParams).
91 | * @param {Object} newParams The set of parameters which will be composited with inherited params.
92 | * @param {Object} $current Internal definition of object representing the current state.
93 | * @param {Object} $to Internal definition of object representing state to transition to.
94 | */
95 | function inheritParams(currentParams, newParams, $current, $to) {
96 | var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];
97 |
98 | for (var i in parents) {
99 | if (!parents[i].params) continue;
100 | parentParams = objectKeys(parents[i].params);
101 | if (!parentParams.length) continue;
102 |
103 | for (var j in parentParams) {
104 | if (arraySearch(inheritList, parentParams[j]) >= 0) continue;
105 | inheritList.push(parentParams[j]);
106 | inherited[parentParams[j]] = currentParams[parentParams[j]];
107 | }
108 | }
109 | return extend({}, inherited, newParams);
110 | }
111 |
112 | /**
113 | * Performs a non-strict comparison of the subset of two objects, defined by a list of keys.
114 | *
115 | * @param {Object} a The first object.
116 | * @param {Object} b The second object.
117 | * @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,
118 | * it defaults to the list of keys in `a`.
119 | * @return {Boolean} Returns `true` if the keys match, otherwise `false`.
120 | */
121 | function equalForKeys(a, b, keys) {
122 | if (!keys) {
123 | keys = [];
124 | for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility
125 | }
126 |
127 | for (var i=0; i
212 | *
213 | *
214 | *
215 | *
216 | *
217 | *
218 | *
222 | *
223 | *
224 | *
225 | *
226 | *
227 | */
228 | angular.module('ui.router', ['ui.router.state']);
229 |
230 | angular.module('ui.router.compat', ['ui.router']);
231 |
--------------------------------------------------------------------------------
/example/public/components/Countable/README.md:
--------------------------------------------------------------------------------
1 | # Countable
2 |
3 | [](https://travis-ci.org/RadLikeWhoa/Countable)
4 |
5 | Countable is a JavaScript function to add **live paragraph-, word- and character-counting** to an HTML element. Countable is a *zero-dependency* library and comes in at **1KB** when minified and gzipped.
6 |
7 | [**View the Demo**](http://radlikewhoa.github.io/Countable#demo)
8 |
9 | ## Installation
10 |
11 | The preferred method of installation is [**bower**](https://github.com/bower/bower).
12 |
13 | ```
14 | bower install Countable
15 | ```
16 |
17 | Alternatively, you can download the latest [zipball](https://github.com/RadLikeWhoa/Countable/archive/master.zip) or copy the [script](https://raw.github.com/RadLikeWhoa/Countable/master/Countable.js) directly.
18 |
19 | ## Usage
20 |
21 | Countable is available as a Node / CommonJS module, an AMD module and as a global. All methods are accessed on the Countable object directly.
22 |
23 | ### Callbacks
24 |
25 | The `live` and `once` methods both accept a callback. The given callback is then called whenever needed with a single parameter that carries all the releavant data. `this` is bound to the current element. Take the following code for an example.
26 |
27 | ```javascript
28 | var area = document.getElementById('text')
29 |
30 | Countable.once(area, function (counter) {
31 | console.log(this, counter)
32 | })
33 | ```
34 |
35 | ```
36 | => , { all: 0, characters: 0, paragraphs: 0, words: 0 }
37 | ```
38 |
39 | Property | Meaning
40 | ---------- | --------------------------------------------------------------------------------------------
41 | paragraphs | The number of paragraphs. Paragraphs can be separated by either a soft or a hard (two line breaks) return. To use hard returns, set the corresponding option (`hardReturns`).
42 | words | The number of words. Words are split using spaces.
43 | characters | The number of characters (without spaces). This contains all non-whitespace characters.
44 | all | The number of characters including whitespace. This is the total number of all characters in the element.
45 |
46 | ### Countable#live(elements, callback, options)
47 |
48 | Bind the callback to all given elements. The callback gets called everytime the element's value or text is changed.
49 |
50 | ```javascript
51 | Countable.live(area, function (counter) {
52 | console.log(counter)
53 | })
54 | ```
55 |
56 | ### Countable#die(elements)
57 |
58 | Remove the bound callback from all given elements.
59 |
60 | ```javascript
61 | Countable.die(area)
62 | ```
63 |
64 | ### Countable#once(elements, callback, options)
65 |
66 | Similar to `Countable.live()`, but the callback is only executed once, there are no events bound.
67 |
68 | ```javascript
69 | Countable.once(area, function (counter) {
70 | console.log(counter)
71 | })
72 | ```
73 |
74 | ### Countable#enabled(element)
75 |
76 | Checks the live-counting functionality is bound to the given.
77 |
78 | ```javascript
79 | Countable.enabled(area)
80 | ```
81 |
82 | ### Options
83 |
84 | `Countable.live()` and `Countable.once()` both accept a third argument, an options object that allows you to change how Countable treats certain aspects of your element's text.
85 |
86 | ```javascript
87 | {
88 | hardReturns: false,
89 | stripTags: false,
90 | ignoreReturns: false
91 | }
92 | ```
93 |
94 | By default, paragraphs are split by a single return (a soft return). By setting `hardReturns` to true, Countable splits paragraphs after two returns.
95 |
96 | Depending on your application and audience, you might need to strip HTML tags from the text before counting it. You can do this by setting `stripTags` to true.
97 |
98 | In most cases, returns should be counted as part of the `all` property. Set `ignoreReturns` to false to remove them from the counter.
99 |
100 | ## Browser Support
101 |
102 | Countable supports all modern browsers. Internet Explorer is supported down to version 7. Note that some browsers don't implement the `oninput` event consistently so there might be differences in the way Countable works in different browsers.
103 |
104 | ## Upgrading from version 1.x.x
105 |
106 | Upgrading from version 1.x.x is easy. Most likely, you've used something like the following:
107 |
108 | ```javascript
109 | var area = document.getElementById('area')
110 |
111 | new Countable(area, function (counter) {
112 | console.log(counter)
113 | }, { stripTags: true })
114 | ```
115 |
116 | The new syntax offers more functions as described above, but to keep the live-counting functionality, you just write this:
117 |
118 | ```javascript
119 | var area = document.getElementById('area')
120 |
121 | Countable.live(area, function (counter) {
122 | console.log(counter)
123 | }, { stripTags: true })
124 | ```
125 |
126 | * The callback parameter is no longer optional
127 | * `options.once` has been replaced with `Countable.once()`
128 | * `Countable.live()` and `Countable.once()` both accept one or more elements, rather than just a single one
129 | * Inside the callback, `this` is now bound to the current element
130 |
131 | ## Changelog
132 |
133 | ### 2.0.2 _(2014-02-19)_
134 |
135 | * NEW: Returns are counted as part of the `all` property. A new option `ignoreReturns` was added to restore the old behaviour.
136 |
137 | ### 2.0.1 _(2013-07-13)_
138 |
139 | * FIX: Missing parameter in `Countable.once`. (Thanks to [MrOPR](https://github.com/RadLikeWhoa/Countable/pull/18))
140 |
141 | ### 2.0.0 _(2013-05-25)_
142 |
143 | * NEW: Countable has a new Syntax. You can now use `Countable.live`, `Countable.once`, `Countable.die` and `Countable.enabled`. Notes on upgrading is provided in the README.
144 | * NEW: Countable can now work on multiple elements with one function call.
145 | * FIX: Prevent a XSS bug. (Thanks to [Rob--W](https://github.com/RadLikeWhoa/Countable/pull/17))
146 |
147 | ### 1.4.2 _(2013-05-23)_
148 |
149 | * FIX: Fix a bug where options wouldn't be applied correctly.
150 |
151 | ### 1.4.1 _(2013-05-22)_
152 |
153 | * NEW: Added option to execute the callback only once.
154 |
155 | ### 1.4.0 _(2013-05-20)_
156 |
157 | * NEW: Allow for an options object as the third parameter.
158 |
159 | ### 1.3.0 _(2013-05-16)_
160 |
161 | * NEW: Countable is now available as an AMD and CommonJS module.
162 | * FIX: Better handle `textarea` with predefined value. (Thanks to [besmithett](https://github.com/RadLikeWhoa/Countable/pull/15))
163 |
164 | ### 1.2.0 _(2013-05-02)_
165 |
166 | * NEW: Optionally strip HTML tags. (Thanks to [craniumslows](https://github.com/RadLikeWhoa/Countable/pull/13))
167 | * NEW: Include ucs2decode function from the [punycode](https://github.com/bestiejs/punycode.js) library to better handle special characters. (Thanks to [craniumslows](https://github.com/RadLikeWhoa/Countable/pull/13))
168 | * IMPROVED: Better handling of punctuation.
169 |
170 | ### 1.1.1 _(2013-03-16)_
171 |
172 | * IMPROVED: Better support for foreign languages and special characters.
173 |
174 | ### 1.1.0 _(2013-03-12)_
175 |
176 | * NEW: Include number of characters including whitespace.
177 | * NEW: Countable is now available on Bower.
178 | * IMPROVED: Improve performance when counting the values.
179 | * IMPROVED: Improve performance when trimming strings by using `String::trim` when available.
180 | * IMPROVED: Better documentation.
181 |
182 | ### 1.0.0 _(2013-03-11)_
183 |
184 | * Initial release
185 |
186 | ## About the Author
187 |
188 | My name is [Sacha Schmid](http://sachaschmid.ch) ([**@sachaschmid**](https://twitter.com/sachaschmid)). I'm a front-end engineer from Switzerland. I am the creator of [SSGS](http://github.com/RadLikeWhoa/SSGS) and [other open source projects](https://github.com/RadLikeWhoa).
189 |
190 | Are you using Countable in a project? I'd love to see what you've achieved. Just [**send me a tweet**](https://twitter.com/sachaschmid).
191 |
192 | ### Contributors
193 |
194 | * [@epmatsw](https://github.com/epmatsw)
195 | * [@craniumslows](https://github.com/craniumslows)
196 | * [@Rob--W](https://github.com/Rob--W)
197 |
--------------------------------------------------------------------------------
/example/public/components/ui-router/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
2 | ### 0.2.11 (2014-08-26)
3 |
4 |
5 | #### Bug Fixes
6 |
7 | * **$resolve:** Resolves only inherit from immediate parent fixes #702 ([df34e20c](https://github.com/angular-ui/ui-router/commit/df34e20c576299e7a3c8bd4ebc68d42341c0ace9))
8 | * **$state:**
9 | * change $state.href default options.inherit to true ([deea695f](https://github.com/angular-ui/ui-router/commit/deea695f5cacc55de351ab985144fd233c02a769))
10 | * sanity-check state lookups ([456fd5ae](https://github.com/angular-ui/ui-router/commit/456fd5aec9ea507518927bfabd62b4afad4cf714), closes [#980](https://github.com/angular-ui/ui-router/issues/980))
11 | * didn't comply to inherit parameter ([09836781](https://github.com/angular-ui/ui-router/commit/09836781f126c1c485b06551eb9cfd4fa0f45c35))
12 | * allow view content loading broadcast ([7b78edee](https://github.com/angular-ui/ui-router/commit/7b78edeeb52a74abf4d3f00f79534033d5a08d1a))
13 | * **$urlMatcherFactory:**
14 | * detect injected functions ([91f75ae6](https://github.com/angular-ui/ui-router/commit/91f75ae66c4d129f6f69e53bd547594e9661f5d5))
15 | * syntax ([1ebed370](https://github.com/angular-ui/ui-router/commit/1ebed37069bae8614d41541d56521f5c45f703f3))
16 | * **UrlMatcher:**
17 | * query param function defaults ([f9c20530](https://github.com/angular-ui/ui-router/commit/f9c205304f10d8a4ebe7efe9025e642016479a51))
18 | * don't decode default values ([63607bdb](https://github.com/angular-ui/ui-router/commit/63607bdbbcb432d3fb37856a1cb3da0cd496804e))
19 | * **travis:** update Node version to fix build ([d6b95ef2](https://github.com/angular-ui/ui-router/commit/d6b95ef23d9dacb4eba08897f5190a0bcddb3a48))
20 | * **uiSref:**
21 | * Generate an href for states with a blank url. closes #1293 ([691745b1](https://github.com/angular-ui/ui-router/commit/691745b12fa05d3700dd28f0c8d25f8a105074ad))
22 | * should inherit params by default ([b973dad1](https://github.com/angular-ui/ui-router/commit/b973dad155ad09a7975e1476bd096f7b2c758eeb))
23 | * cancel transition if preventDefault() has been called ([2e6d9167](https://github.com/angular-ui/ui-router/commit/2e6d9167d3afbfbca6427e53e012f94fb5fb8022))
24 | * **uiView:** Fixed infinite loop when is called .go() from a controller. ([e13988b8](https://github.com/angular-ui/ui-router/commit/e13988b8cd6231d75c78876ee9d012cc87f4a8d9), closes [#1194](https://github.com/angular-ui/ui-router/issues/1194))
25 | * **docs:**
26 | * Fixed link to milestones ([6c0ae500](https://github.com/angular-ui/ui-router/commit/6c0ae500cc238ea9fc95adcc15415c55fc9e1f33))
27 | * fix bug in decorator example ([4bd00af5](https://github.com/angular-ui/ui-router/commit/4bd00af50b8b88a49d1545a76290731cb8e0feb1))
28 | * Removed an incorrect semi-colon ([af97cef8](https://github.com/angular-ui/ui-router/commit/af97cef8b967f2e32177e539ef41450dca131a7d))
29 | * Explain return value of rule as function ([5e887890](https://github.com/angular-ui/ui-router/commit/5e8878900a6ffe59a81aed531a3925e34a297377))
30 |
31 |
32 | #### Features
33 |
34 | * **$state:**
35 | * allow parameters to pass unharmed ([8939d057](https://github.com/angular-ui/ui-router/commit/8939d0572ab1316e458ef016317ecff53131a822))
36 | * allow prevent syncUrl on failure ([753060b9](https://github.com/angular-ui/ui-router/commit/753060b910d5d2da600a6fa0757976e401c33172))
37 | * **typescript:** Add typescript definitions for component builds ([521ceb3f](https://github.com/angular-ui/ui-router/commit/521ceb3fd7850646422f411921e21ce5e7d82e0f))
38 | * **uiSref:** extend syntax for ui-sref ([71cad3d6](https://github.com/angular-ui/ui-router/commit/71cad3d636508b5a9fe004775ad1f1adc0c80c3e))
39 | * **uiSrefActive:**
40 | * **BREAKING CHANGE** Also activate for child states. ([bf163ad6](https://github.com/angular-ui/ui-router/commit/bf163ad6ce176ce28792696c8302d7cdf5c05a01), closes [#818](https://github.com/angular-ui/ui-router/issues/818))
41 | * uiSrefActiveEq: new directive with old ui-sref-active behavior
42 | * **$urlRouter:**
43 | * defer URL change interception ([c72d8ce1](https://github.com/angular-ui/ui-router/commit/c72d8ce11916d0ac22c81b409c9e61d7048554d7))
44 | * force URLs to have valid params ([d48505cd](https://github.com/angular-ui/ui-router/commit/d48505cd328d83e39d5706e085ba319715f999a6))
45 | * abstract $location handling ([08b4636b](https://github.com/angular-ui/ui-router/commit/08b4636b294611f08db35f00641eb5211686fb50))
46 | * **$urlMatcherFactory:**
47 | * fail on bad parameters ([d8f124c1](https://github.com/angular-ui/ui-router/commit/d8f124c10d00c7e5dde88c602d966db261aea221))
48 | * date type support ([b7f074ff](https://github.com/angular-ui/ui-router/commit/b7f074ff65ca150a3cdbda4d5ad6cb17107300eb))
49 | * implement type support ([450b1f0e](https://github.com/angular-ui/ui-router/commit/450b1f0e8e03c738174ff967f688b9a6373290f4))
50 | * **UrlMatcher:**
51 | * handle query string arrays ([9cf764ef](https://github.com/angular-ui/ui-router/commit/9cf764efab45fa9309368688d535ddf6e96d6449), closes [#373](https://github.com/angular-ui/ui-router/issues/373))
52 | * injectable functions as defaults ([00966ecd](https://github.com/angular-ui/ui-router/commit/00966ecd91fb745846039160cab707bfca8b3bec))
53 | * default values & type decoding for query params ([a472b301](https://github.com/angular-ui/ui-router/commit/a472b301389fbe84d1c1fa9f24852b492a569d11))
54 | * allow shorthand definitions ([5b724304](https://github.com/angular-ui/ui-router/commit/5b7243049793505e44b6608ea09878c37c95b1f5))
55 | * validates whole interface ([32b27db1](https://github.com/angular-ui/ui-router/commit/32b27db173722e9194ef1d5c0ea7d93f25a98d11))
56 | * implement non-strict matching ([a3e21366](https://github.com/angular-ui/ui-router/commit/a3e21366bee0475c9795a1ec76f70eec41c5b4e3))
57 | * add per-param config support ([07b3029f](https://github.com/angular-ui/ui-router/commit/07b3029f4d409cf955780113df92e36401b47580))
58 |
59 |
60 | ### 0.2.10 (2014-03-12)
61 |
62 |
63 | #### Bug Fixes
64 |
65 | * **$state:** use $browser.baseHref() when generating urls with .href() ([cbcc8488](https://github.com/angular-ui/ui-router/commit/cbcc84887d6b6d35258adabb97c714cd9c1e272d))
66 | * **bower.json:** JS files should not be ignored ([ccdab193](https://github.com/angular-ui/ui-router/commit/ccdab193315f304eb3be5f5b97c47a926c79263e))
67 | * **dev:** karma:background task is missing, can't run grunt:dev. ([d9f7b898](https://github.com/angular-ui/ui-router/commit/d9f7b898e8e3abb8c846b0faa16a382913d7b22b))
68 | * **sample:** Contacts menu button not staying active when navigating to detail states. Need t ([2fcb8443](https://github.com/angular-ui/ui-router/commit/2fcb84437cb43ade12682a92b764f13cac77dfe7))
69 | * **uiSref:** support mock-clicks/events with no data ([717d3ff7](https://github.com/angular-ui/ui-router/commit/717d3ff7d0ba72d239892dee562b401cdf90e418))
70 | * **uiView:**
71 | * Do NOT autoscroll when autoscroll attr is missing ([affe5bd7](https://github.com/angular-ui/ui-router/commit/affe5bd785cdc3f02b7a9f64a52e3900386ec3a0), closes [#807](https://github.com/angular-ui/ui-router/issues/807))
72 | * Refactoring uiView directive to copy ngView logic ([548fab6a](https://github.com/angular-ui/ui-router/commit/548fab6ab9debc9904c5865c8bc68b4fc3271dd0), closes [#857](https://github.com/angular-ui/ui-router/issues/857), [#552](https://github.com/angular-ui/ui-router/issues/552))
73 |
74 |
75 | #### Features
76 |
77 | * **$state:** includes() allows glob patterns for state matching. ([2d5f6b37](https://github.com/angular-ui/ui-router/commit/2d5f6b37191a3135f4a6d9e8f344c54edcdc065b))
78 | * **UrlMatcher:** Add support for case insensitive url matching ([642d5247](https://github.com/angular-ui/ui-router/commit/642d524799f604811e680331002feec7199a1fb5))
79 | * **uiSref:** add support for transition options ([2ed7a728](https://github.com/angular-ui/ui-router/commit/2ed7a728cee6854b38501fbc1df6139d3de5b28a))
80 | * **uiView:** add controllerAs config with function ([1ee7334a](https://github.com/angular-ui/ui-router/commit/1ee7334a73efeccc9b95340e315cdfd59944762d))
81 |
82 |
83 | ### 0.2.9 (2014-01-17)
84 |
85 |
86 | This release is identical to 0.2.8. 0.2.8 was re-tagged in git to fix a problem with bower.
87 |
88 |
89 | ### 0.2.8 (2014-01-16)
90 |
91 |
92 | #### Bug Fixes
93 |
94 | * **$state:** allow null to be passed as 'params' param ([094dc30e](https://github.com/angular-ui/ui-router/commit/094dc30e883e1bd14e50a475553bafeaade3b178))
95 | * **$state.go:** param inheritance shouldn't inherit from siblings ([aea872e0](https://github.com/angular-ui/ui-router/commit/aea872e0b983cb433436ce5875df10c838fccedb))
96 | * **bower.json:** fixes bower.json ([eed3cc4d](https://github.com/angular-ui/ui-router/commit/eed3cc4d4dfef1d3ef84b9fd063127538ebf59d3))
97 | * **uiSrefActive:** annotate controller injection ([85921422](https://github.com/angular-ui/ui-router/commit/85921422ff7fb0effed358136426d616cce3d583), closes [#671](https://github.com/angular-ui/ui-router/issues/671))
98 | * **uiView:**
99 | * autoscroll tests pass on 1.2.4 & 1.1.5 ([86eacac0](https://github.com/angular-ui/ui-router/commit/86eacac09ca5e9000bd3b9c7ba6e2cc95d883a3a))
100 | * don't animate initial load ([83b6634d](https://github.com/angular-ui/ui-router/commit/83b6634d27942ca74766b2b1244a7fc52c5643d9))
101 | * test pass against 1.0.8 and 1.2.4 ([a402415a](https://github.com/angular-ui/ui-router/commit/a402415a2a28b360c43b9fe8f4f54c540f6c33de))
102 | * it should autoscroll when expr is missing. ([8bb9e27a](https://github.com/angular-ui/ui-router/commit/8bb9e27a2986725f45daf44c4c9f846385095aff))
103 |
104 |
105 | #### Features
106 |
107 | * **uiSref:** add target attribute behaviour ([c12bf9a5](https://github.com/angular-ui/ui-router/commit/c12bf9a520d30d70294e3d82de7661900f8e394e))
108 | * **uiView:**
109 | * merge autoscroll expression test. ([b89e0f87](https://github.com/angular-ui/ui-router/commit/b89e0f871d5cc35c10925ede986c10684d5c9252))
110 | * cache and test autoscroll expression ([ee262282](https://github.com/angular-ui/ui-router/commit/ee2622828c2ce83807f006a459ac4e11406d9258))
111 |
--------------------------------------------------------------------------------
/example/public/components/pusher-angular/example/public/components/ui-router/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
2 | ### 0.2.11 (2014-08-26)
3 |
4 |
5 | #### Bug Fixes
6 |
7 | * **$resolve:** Resolves only inherit from immediate parent fixes #702 ([df34e20c](https://github.com/angular-ui/ui-router/commit/df34e20c576299e7a3c8bd4ebc68d42341c0ace9))
8 | * **$state:**
9 | * change $state.href default options.inherit to true ([deea695f](https://github.com/angular-ui/ui-router/commit/deea695f5cacc55de351ab985144fd233c02a769))
10 | * sanity-check state lookups ([456fd5ae](https://github.com/angular-ui/ui-router/commit/456fd5aec9ea507518927bfabd62b4afad4cf714), closes [#980](https://github.com/angular-ui/ui-router/issues/980))
11 | * didn't comply to inherit parameter ([09836781](https://github.com/angular-ui/ui-router/commit/09836781f126c1c485b06551eb9cfd4fa0f45c35))
12 | * allow view content loading broadcast ([7b78edee](https://github.com/angular-ui/ui-router/commit/7b78edeeb52a74abf4d3f00f79534033d5a08d1a))
13 | * **$urlMatcherFactory:**
14 | * detect injected functions ([91f75ae6](https://github.com/angular-ui/ui-router/commit/91f75ae66c4d129f6f69e53bd547594e9661f5d5))
15 | * syntax ([1ebed370](https://github.com/angular-ui/ui-router/commit/1ebed37069bae8614d41541d56521f5c45f703f3))
16 | * **UrlMatcher:**
17 | * query param function defaults ([f9c20530](https://github.com/angular-ui/ui-router/commit/f9c205304f10d8a4ebe7efe9025e642016479a51))
18 | * don't decode default values ([63607bdb](https://github.com/angular-ui/ui-router/commit/63607bdbbcb432d3fb37856a1cb3da0cd496804e))
19 | * **travis:** update Node version to fix build ([d6b95ef2](https://github.com/angular-ui/ui-router/commit/d6b95ef23d9dacb4eba08897f5190a0bcddb3a48))
20 | * **uiSref:**
21 | * Generate an href for states with a blank url. closes #1293 ([691745b1](https://github.com/angular-ui/ui-router/commit/691745b12fa05d3700dd28f0c8d25f8a105074ad))
22 | * should inherit params by default ([b973dad1](https://github.com/angular-ui/ui-router/commit/b973dad155ad09a7975e1476bd096f7b2c758eeb))
23 | * cancel transition if preventDefault() has been called ([2e6d9167](https://github.com/angular-ui/ui-router/commit/2e6d9167d3afbfbca6427e53e012f94fb5fb8022))
24 | * **uiView:** Fixed infinite loop when is called .go() from a controller. ([e13988b8](https://github.com/angular-ui/ui-router/commit/e13988b8cd6231d75c78876ee9d012cc87f4a8d9), closes [#1194](https://github.com/angular-ui/ui-router/issues/1194))
25 | * **docs:**
26 | * Fixed link to milestones ([6c0ae500](https://github.com/angular-ui/ui-router/commit/6c0ae500cc238ea9fc95adcc15415c55fc9e1f33))
27 | * fix bug in decorator example ([4bd00af5](https://github.com/angular-ui/ui-router/commit/4bd00af50b8b88a49d1545a76290731cb8e0feb1))
28 | * Removed an incorrect semi-colon ([af97cef8](https://github.com/angular-ui/ui-router/commit/af97cef8b967f2e32177e539ef41450dca131a7d))
29 | * Explain return value of rule as function ([5e887890](https://github.com/angular-ui/ui-router/commit/5e8878900a6ffe59a81aed531a3925e34a297377))
30 |
31 |
32 | #### Features
33 |
34 | * **$state:**
35 | * allow parameters to pass unharmed ([8939d057](https://github.com/angular-ui/ui-router/commit/8939d0572ab1316e458ef016317ecff53131a822))
36 | * allow prevent syncUrl on failure ([753060b9](https://github.com/angular-ui/ui-router/commit/753060b910d5d2da600a6fa0757976e401c33172))
37 | * **typescript:** Add typescript definitions for component builds ([521ceb3f](https://github.com/angular-ui/ui-router/commit/521ceb3fd7850646422f411921e21ce5e7d82e0f))
38 | * **uiSref:** extend syntax for ui-sref ([71cad3d6](https://github.com/angular-ui/ui-router/commit/71cad3d636508b5a9fe004775ad1f1adc0c80c3e))
39 | * **uiSrefActive:**
40 | * **BREAKING CHANGE** Also activate for child states. ([bf163ad6](https://github.com/angular-ui/ui-router/commit/bf163ad6ce176ce28792696c8302d7cdf5c05a01), closes [#818](https://github.com/angular-ui/ui-router/issues/818))
41 | * uiSrefActiveEq: new directive with old ui-sref-active behavior
42 | * **$urlRouter:**
43 | * defer URL change interception ([c72d8ce1](https://github.com/angular-ui/ui-router/commit/c72d8ce11916d0ac22c81b409c9e61d7048554d7))
44 | * force URLs to have valid params ([d48505cd](https://github.com/angular-ui/ui-router/commit/d48505cd328d83e39d5706e085ba319715f999a6))
45 | * abstract $location handling ([08b4636b](https://github.com/angular-ui/ui-router/commit/08b4636b294611f08db35f00641eb5211686fb50))
46 | * **$urlMatcherFactory:**
47 | * fail on bad parameters ([d8f124c1](https://github.com/angular-ui/ui-router/commit/d8f124c10d00c7e5dde88c602d966db261aea221))
48 | * date type support ([b7f074ff](https://github.com/angular-ui/ui-router/commit/b7f074ff65ca150a3cdbda4d5ad6cb17107300eb))
49 | * implement type support ([450b1f0e](https://github.com/angular-ui/ui-router/commit/450b1f0e8e03c738174ff967f688b9a6373290f4))
50 | * **UrlMatcher:**
51 | * handle query string arrays ([9cf764ef](https://github.com/angular-ui/ui-router/commit/9cf764efab45fa9309368688d535ddf6e96d6449), closes [#373](https://github.com/angular-ui/ui-router/issues/373))
52 | * injectable functions as defaults ([00966ecd](https://github.com/angular-ui/ui-router/commit/00966ecd91fb745846039160cab707bfca8b3bec))
53 | * default values & type decoding for query params ([a472b301](https://github.com/angular-ui/ui-router/commit/a472b301389fbe84d1c1fa9f24852b492a569d11))
54 | * allow shorthand definitions ([5b724304](https://github.com/angular-ui/ui-router/commit/5b7243049793505e44b6608ea09878c37c95b1f5))
55 | * validates whole interface ([32b27db1](https://github.com/angular-ui/ui-router/commit/32b27db173722e9194ef1d5c0ea7d93f25a98d11))
56 | * implement non-strict matching ([a3e21366](https://github.com/angular-ui/ui-router/commit/a3e21366bee0475c9795a1ec76f70eec41c5b4e3))
57 | * add per-param config support ([07b3029f](https://github.com/angular-ui/ui-router/commit/07b3029f4d409cf955780113df92e36401b47580))
58 |
59 |
60 | ### 0.2.10 (2014-03-12)
61 |
62 |
63 | #### Bug Fixes
64 |
65 | * **$state:** use $browser.baseHref() when generating urls with .href() ([cbcc8488](https://github.com/angular-ui/ui-router/commit/cbcc84887d6b6d35258adabb97c714cd9c1e272d))
66 | * **bower.json:** JS files should not be ignored ([ccdab193](https://github.com/angular-ui/ui-router/commit/ccdab193315f304eb3be5f5b97c47a926c79263e))
67 | * **dev:** karma:background task is missing, can't run grunt:dev. ([d9f7b898](https://github.com/angular-ui/ui-router/commit/d9f7b898e8e3abb8c846b0faa16a382913d7b22b))
68 | * **sample:** Contacts menu button not staying active when navigating to detail states. Need t ([2fcb8443](https://github.com/angular-ui/ui-router/commit/2fcb84437cb43ade12682a92b764f13cac77dfe7))
69 | * **uiSref:** support mock-clicks/events with no data ([717d3ff7](https://github.com/angular-ui/ui-router/commit/717d3ff7d0ba72d239892dee562b401cdf90e418))
70 | * **uiView:**
71 | * Do NOT autoscroll when autoscroll attr is missing ([affe5bd7](https://github.com/angular-ui/ui-router/commit/affe5bd785cdc3f02b7a9f64a52e3900386ec3a0), closes [#807](https://github.com/angular-ui/ui-router/issues/807))
72 | * Refactoring uiView directive to copy ngView logic ([548fab6a](https://github.com/angular-ui/ui-router/commit/548fab6ab9debc9904c5865c8bc68b4fc3271dd0), closes [#857](https://github.com/angular-ui/ui-router/issues/857), [#552](https://github.com/angular-ui/ui-router/issues/552))
73 |
74 |
75 | #### Features
76 |
77 | * **$state:** includes() allows glob patterns for state matching. ([2d5f6b37](https://github.com/angular-ui/ui-router/commit/2d5f6b37191a3135f4a6d9e8f344c54edcdc065b))
78 | * **UrlMatcher:** Add support for case insensitive url matching ([642d5247](https://github.com/angular-ui/ui-router/commit/642d524799f604811e680331002feec7199a1fb5))
79 | * **uiSref:** add support for transition options ([2ed7a728](https://github.com/angular-ui/ui-router/commit/2ed7a728cee6854b38501fbc1df6139d3de5b28a))
80 | * **uiView:** add controllerAs config with function ([1ee7334a](https://github.com/angular-ui/ui-router/commit/1ee7334a73efeccc9b95340e315cdfd59944762d))
81 |
82 |
83 | ### 0.2.9 (2014-01-17)
84 |
85 |
86 | This release is identical to 0.2.8. 0.2.8 was re-tagged in git to fix a problem with bower.
87 |
88 |
89 | ### 0.2.8 (2014-01-16)
90 |
91 |
92 | #### Bug Fixes
93 |
94 | * **$state:** allow null to be passed as 'params' param ([094dc30e](https://github.com/angular-ui/ui-router/commit/094dc30e883e1bd14e50a475553bafeaade3b178))
95 | * **$state.go:** param inheritance shouldn't inherit from siblings ([aea872e0](https://github.com/angular-ui/ui-router/commit/aea872e0b983cb433436ce5875df10c838fccedb))
96 | * **bower.json:** fixes bower.json ([eed3cc4d](https://github.com/angular-ui/ui-router/commit/eed3cc4d4dfef1d3ef84b9fd063127538ebf59d3))
97 | * **uiSrefActive:** annotate controller injection ([85921422](https://github.com/angular-ui/ui-router/commit/85921422ff7fb0effed358136426d616cce3d583), closes [#671](https://github.com/angular-ui/ui-router/issues/671))
98 | * **uiView:**
99 | * autoscroll tests pass on 1.2.4 & 1.1.5 ([86eacac0](https://github.com/angular-ui/ui-router/commit/86eacac09ca5e9000bd3b9c7ba6e2cc95d883a3a))
100 | * don't animate initial load ([83b6634d](https://github.com/angular-ui/ui-router/commit/83b6634d27942ca74766b2b1244a7fc52c5643d9))
101 | * test pass against 1.0.8 and 1.2.4 ([a402415a](https://github.com/angular-ui/ui-router/commit/a402415a2a28b360c43b9fe8f4f54c540f6c33de))
102 | * it should autoscroll when expr is missing. ([8bb9e27a](https://github.com/angular-ui/ui-router/commit/8bb9e27a2986725f45daf44c4c9f846385095aff))
103 |
104 |
105 | #### Features
106 |
107 | * **uiSref:** add target attribute behaviour ([c12bf9a5](https://github.com/angular-ui/ui-router/commit/c12bf9a520d30d70294e3d82de7661900f8e394e))
108 | * **uiView:**
109 | * merge autoscroll expression test. ([b89e0f87](https://github.com/angular-ui/ui-router/commit/b89e0f871d5cc35c10925ede986c10684d5c9252))
110 | * cache and test autoscroll expression ([ee262282](https://github.com/angular-ui/ui-router/commit/ee2622828c2ce83807f006a459ac4e11406d9258))
111 |
--------------------------------------------------------------------------------
/example/public/components/ui-router/src/viewDirective.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @ngdoc directive
3 | * @name ui.router.state.directive:ui-view
4 | *
5 | * @requires ui.router.state.$state
6 | * @requires $compile
7 | * @requires $controller
8 | * @requires $injector
9 | * @requires ui.router.state.$uiViewScroll
10 | * @requires $document
11 | *
12 | * @restrict ECA
13 | *
14 | * @description
15 | * The ui-view directive tells $state where to place your templates.
16 | *
17 | * @param {string=} ui-view A view name. The name should be unique amongst the other views in the
18 | * same state. You can have views of the same name that live in different states.
19 | *
20 | * @param {string=} autoscroll It allows you to set the scroll behavior of the browser window
21 | * when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll
22 | * service, {@link ui.router.state.$uiViewScroll}. This custom service let's you
23 | * scroll ui-view elements into view when they are populated during a state activation.
24 | *
25 | * *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)
26 | * functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*
27 | *
28 | * @param {string=} onload Expression to evaluate whenever the view updates.
29 | *
30 | * @example
31 | * A view can be unnamed or named.
32 | *
33 | *
34 | *
35 | *
36 | *
37 | *
38 | *
39 | *
40 | * You can only have one unnamed view within any template (or root html). If you are only using a
41 | * single view and it is unnamed then you can populate it like so:
42 | *
48 | *
49 | * The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}
50 | * config property, by name, in this case an empty name:
51 | *
60 | *
61 | * But typically you'll only use the views property if you name your view or have more than one view
62 | * in the same template. There's not really a compelling reason to name a view if its the only one,
63 | * but you could if you wanted, like so:
64 | *
113 | */
114 | $ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll'];
115 | function $ViewDirective( $state, $injector, $uiViewScroll) {
116 |
117 | function getService() {
118 | return ($injector.has) ? function(service) {
119 | return $injector.has(service) ? $injector.get(service) : null;
120 | } : function(service) {
121 | try {
122 | return $injector.get(service);
123 | } catch (e) {
124 | return null;
125 | }
126 | };
127 | }
128 |
129 | var service = getService(),
130 | $animator = service('$animator'),
131 | $animate = service('$animate');
132 |
133 | // Returns a set of DOM manipulation functions based on which Angular version
134 | // it should use
135 | function getRenderer(attrs, scope) {
136 | var statics = function() {
137 | return {
138 | enter: function (element, target, cb) { target.after(element); cb(); },
139 | leave: function (element, cb) { element.remove(); cb(); }
140 | };
141 | };
142 |
143 | if ($animate) {
144 | return {
145 | enter: function(element, target, cb) { $animate.enter(element, null, target, cb); },
146 | leave: function(element, cb) { $animate.leave(element, cb); }
147 | };
148 | }
149 |
150 | if ($animator) {
151 | var animate = $animator && $animator(scope, attrs);
152 |
153 | return {
154 | enter: function(element, target, cb) {animate.enter(element, null, target); cb(); },
155 | leave: function(element, cb) { animate.leave(element); cb(); }
156 | };
157 | }
158 |
159 | return statics();
160 | }
161 |
162 | var directive = {
163 | restrict: 'ECA',
164 | terminal: true,
165 | priority: 400,
166 | transclude: 'element',
167 | compile: function (tElement, tAttrs, $transclude) {
168 | return function (scope, $element, attrs) {
169 | var previousEl, currentEl, currentScope, latestLocals,
170 | onloadExp = attrs.onload || '',
171 | autoScrollExp = attrs.autoscroll,
172 | renderer = getRenderer(attrs, scope);
173 |
174 | scope.$on('$stateChangeSuccess', function() {
175 | updateView(false);
176 | });
177 | scope.$on('$viewContentLoading', function() {
178 | updateView(false);
179 | });
180 |
181 | updateView(true);
182 |
183 | function cleanupLastView() {
184 | if (previousEl) {
185 | previousEl.remove();
186 | previousEl = null;
187 | }
188 |
189 | if (currentScope) {
190 | currentScope.$destroy();
191 | currentScope = null;
192 | }
193 |
194 | if (currentEl) {
195 | renderer.leave(currentEl, function() {
196 | previousEl = null;
197 | });
198 |
199 | previousEl = currentEl;
200 | currentEl = null;
201 | }
202 | }
203 |
204 | function updateView(firstTime) {
205 | var newScope,
206 | name = getUiViewName(attrs, $element.inheritedData('$uiView')),
207 | previousLocals = name && $state.$current && $state.$current.locals[name];
208 |
209 | if (!firstTime && previousLocals === latestLocals) return; // nothing to do
210 | newScope = scope.$new();
211 | latestLocals = $state.$current.locals[name];
212 |
213 | var clone = $transclude(newScope, function(clone) {
214 | renderer.enter(clone, $element, function onUiViewEnter() {
215 | if (angular.isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {
216 | $uiViewScroll(clone);
217 | }
218 | });
219 | cleanupLastView();
220 | });
221 |
222 | currentEl = clone;
223 | currentScope = newScope;
224 | /**
225 | * @ngdoc event
226 | * @name ui.router.state.directive:ui-view#$viewContentLoaded
227 | * @eventOf ui.router.state.directive:ui-view
228 | * @eventType emits on ui-view directive scope
229 | * @description *
230 | * Fired once the view is **loaded**, *after* the DOM is rendered.
231 | *
232 | * @param {Object} event Event object.
233 | */
234 | currentScope.$emit('$viewContentLoaded');
235 | currentScope.$eval(onloadExp);
236 | }
237 | };
238 | }
239 | };
240 |
241 | return directive;
242 | }
243 |
244 | $ViewDirectiveFill.$inject = ['$compile', '$controller', '$state'];
245 | function $ViewDirectiveFill ($compile, $controller, $state) {
246 | return {
247 | restrict: 'ECA',
248 | priority: -400,
249 | compile: function (tElement) {
250 | var initial = tElement.html();
251 | return function (scope, $element, attrs) {
252 | var current = $state.$current,
253 | name = getUiViewName(attrs, $element.inheritedData('$uiView')),
254 | locals = current && current.locals[name];
255 |
256 | if (! locals) {
257 | return;
258 | }
259 |
260 | $element.data('$uiView', { name: name, state: locals.$$state });
261 | $element.html(locals.$template ? locals.$template : initial);
262 |
263 | var link = $compile($element.contents());
264 |
265 | if (locals.$$controller) {
266 | locals.$scope = scope;
267 | var controller = $controller(locals.$$controller, locals);
268 | if (locals.$$controllerAs) {
269 | scope[locals.$$controllerAs] = controller;
270 | }
271 | $element.data('$ngControllerController', controller);
272 | $element.children().data('$ngControllerController', controller);
273 | }
274 |
275 | link(scope);
276 | };
277 | }
278 | };
279 | }
280 |
281 | /**
282 | * Shared ui-view code for both directives:
283 | * Given attributes and inherited $uiView data, return the view's name
284 | */
285 | function getUiViewName(attrs, inherited) {
286 | var name = attrs.uiView || attrs.name || '';
287 | return name.indexOf('@') >= 0 ? name : (name + '@' + (inherited ? inherited.state.name : ''));
288 | }
289 |
290 | angular.module('ui.router.state').directive('uiView', $ViewDirective);
291 | angular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);
292 |
--------------------------------------------------------------------------------
/example/public/components/pusher-angular/example/public/components/ui-router/src/viewDirective.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @ngdoc directive
3 | * @name ui.router.state.directive:ui-view
4 | *
5 | * @requires ui.router.state.$state
6 | * @requires $compile
7 | * @requires $controller
8 | * @requires $injector
9 | * @requires ui.router.state.$uiViewScroll
10 | * @requires $document
11 | *
12 | * @restrict ECA
13 | *
14 | * @description
15 | * The ui-view directive tells $state where to place your templates.
16 | *
17 | * @param {string=} ui-view A view name. The name should be unique amongst the other views in the
18 | * same state. You can have views of the same name that live in different states.
19 | *
20 | * @param {string=} autoscroll It allows you to set the scroll behavior of the browser window
21 | * when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll
22 | * service, {@link ui.router.state.$uiViewScroll}. This custom service let's you
23 | * scroll ui-view elements into view when they are populated during a state activation.
24 | *
25 | * *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)
26 | * functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*
27 | *
28 | * @param {string=} onload Expression to evaluate whenever the view updates.
29 | *
30 | * @example
31 | * A view can be unnamed or named.
32 | *
33 | *
34 | *
35 | *
36 | *
37 | *
38 | *
39 | *
40 | * You can only have one unnamed view within any template (or root html). If you are only using a
41 | * single view and it is unnamed then you can populate it like so:
42 | *
48 | *
49 | * The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}
50 | * config property, by name, in this case an empty name:
51 | *
60 | *
61 | * But typically you'll only use the views property if you name your view or have more than one view
62 | * in the same template. There's not really a compelling reason to name a view if its the only one,
63 | * but you could if you wanted, like so:
64 | *
179 | *
180 | *
181 | *
182 | * When the app state is "app.user" (or any children states), and contains the state parameter "user" with value "bilbobaggins",
183 | * the resulting HTML will appear as (note the 'active' class):
184 | *
190 | *
191 | *
192 | * The class name is interpolated **once** during the directives link time (any further changes to the
193 | * interpolated value are ignored).
194 | *
195 | * Multiple classes may be specified in a space-separated format:
196 | *
202 | *
203 | */
204 |
205 | /**
206 | * @ngdoc directive
207 | * @name ui.router.state.directive:ui-sref-active-eq
208 | *
209 | * @requires ui.router.state.$state
210 | * @requires ui.router.state.$stateParams
211 | * @requires $interpolate
212 | *
213 | * @restrict A
214 | *
215 | * @description
216 | * The same as {@link ui.router.state.directive:ui-sref-active ui-sref-active} but will will only activate
217 | * when the exact target state used in the `ui-sref` is active; no child states.
218 | *
219 | */
220 | $StateRefActiveDirective.$inject = ['$state', '$stateParams', '$interpolate'];
221 | function $StateRefActiveDirective($state, $stateParams, $interpolate) {
222 | return {
223 | restrict: "A",
224 | controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
225 | var state, params, activeClass;
226 |
227 | // There probably isn't much point in $observing this
228 | // uiSrefActive and uiSrefActiveEq share the same directive object with some
229 | // slight difference in logic routing
230 | activeClass = $interpolate($attrs.uiSrefActiveEq || $attrs.uiSrefActive || '', false)($scope);
231 |
232 | // Allow uiSref to communicate with uiSrefActive[Equals]
233 | this.$$setStateInfo = function (newState, newParams) {
234 | state = $state.get(newState, stateContext($element));
235 | params = newParams;
236 | update();
237 | };
238 |
239 | $scope.$on('$stateChangeSuccess', update);
240 |
241 | // Update route state
242 | function update() {
243 | if (isMatch()) {
244 | $element.addClass(activeClass);
245 | } else {
246 | $element.removeClass(activeClass);
247 | }
248 | }
249 |
250 | function isMatch() {
251 | if (typeof $attrs.uiSrefActiveEq !== 'undefined') {
252 | return $state.$current.self === state && matchesParams();
253 | } else {
254 | return $state.includes(state.name) && matchesParams();
255 | }
256 | }
257 |
258 | function matchesParams() {
259 | return !params || equalForKeys(params, $stateParams);
260 | }
261 | }]
262 | };
263 | }
264 |
265 | angular.module('ui.router.state')
266 | .directive('uiSref', $StateRefDirective)
267 | .directive('uiSrefActive', $StateRefActiveDirective)
268 | .directive('uiSrefActiveEq', $StateRefActiveDirective);
269 |
--------------------------------------------------------------------------------
/example/public/components/pusher-angular/example/public/components/ui-router/src/stateDirectives.js:
--------------------------------------------------------------------------------
1 | function parseStateRef(ref, current) {
2 | var preparsed = ref.match(/^\s*({[^}]*})\s*$/), parsed;
3 | if (preparsed) ref = current + '(' + preparsed[1] + ')';
4 | parsed = ref.replace(/\n/g, " ").match(/^([^(]+?)\s*(\((.*)\))?$/);
5 | if (!parsed || parsed.length !== 4) throw new Error("Invalid state ref '" + ref + "'");
6 | return { state: parsed[1], paramExpr: parsed[3] || null };
7 | }
8 |
9 | function stateContext(el) {
10 | var stateData = el.parent().inheritedData('$uiView');
11 |
12 | if (stateData && stateData.state && stateData.state.name) {
13 | return stateData.state;
14 | }
15 | }
16 |
17 | /**
18 | * @ngdoc directive
19 | * @name ui.router.state.directive:ui-sref
20 | *
21 | * @requires ui.router.state.$state
22 | * @requires $timeout
23 | *
24 | * @restrict A
25 | *
26 | * @description
27 | * A directive that binds a link (`` tag) to a state. If the state has an associated
28 | * URL, the directive will automatically generate & update the `href` attribute via
29 | * the {@link ui.router.state.$state#methods_href $state.href()} method. Clicking
30 | * the link will trigger a state transition with optional parameters.
31 | *
32 | * Also middle-clicking, right-clicking, and ctrl-clicking on the link will be
33 | * handled natively by the browser.
34 | *
35 | * You can also use relative state paths within ui-sref, just like the relative
36 | * paths passed to `$state.go()`. You just need to be aware that the path is relative
37 | * to the state that the link lives in, in other words the state that loaded the
38 | * template containing the link.
39 | *
40 | * You can specify options to pass to {@link ui.router.state.$state#go $state.go()}
41 | * using the `ui-sref-opts` attribute. Options are restricted to `location`, `inherit`,
42 | * and `reload`.
43 | *
44 | * @example
45 | * Here's an example of how you'd use ui-sref and how it would compile. If you have the
46 | * following template:
47 | *
179 | *
180 | *
181 | *
182 | * When the app state is "app.user" (or any children states), and contains the state parameter "user" with value "bilbobaggins",
183 | * the resulting HTML will appear as (note the 'active' class):
184 | *
190 | *
191 | *
192 | * The class name is interpolated **once** during the directives link time (any further changes to the
193 | * interpolated value are ignored).
194 | *
195 | * Multiple classes may be specified in a space-separated format:
196 | *
36 | * but the former is more efficient (in fact `resolve` just calls `study`
37 | * internally).
38 | *
39 | * @param {object} invocables Invocable objects
40 | * @return {function} a function to pass in locals, parent and self
41 | */
42 | this.study = function (invocables) {
43 | if (!isObject(invocables)) throw new Error("'invocables' must be an object");
44 |
45 | // Perform a topological sort of invocables to build an ordered plan
46 | var plan = [], cycle = [], visited = {};
47 | function visit(value, key) {
48 | if (visited[key] === VISIT_DONE) return;
49 |
50 | cycle.push(key);
51 | if (visited[key] === VISIT_IN_PROGRESS) {
52 | cycle.splice(0, cycle.indexOf(key));
53 | throw new Error("Cyclic dependency: " + cycle.join(" -> "));
54 | }
55 | visited[key] = VISIT_IN_PROGRESS;
56 |
57 | if (isString(value)) {
58 | plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES);
59 | } else {
60 | var params = $injector.annotate(value);
61 | forEach(params, function (param) {
62 | if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param);
63 | });
64 | plan.push(key, value, params);
65 | }
66 |
67 | cycle.pop();
68 | visited[key] = VISIT_DONE;
69 | }
70 | forEach(invocables, visit);
71 | invocables = cycle = visited = null; // plan is all that's required
72 |
73 | function isResolve(value) {
74 | return isObject(value) && value.then && value.$$promises;
75 | }
76 |
77 | return function (locals, parent, self) {
78 | if (isResolve(locals) && self === undefined) {
79 | self = parent; parent = locals; locals = null;
80 | }
81 | if (!locals) locals = NO_LOCALS;
82 | else if (!isObject(locals)) {
83 | throw new Error("'locals' must be an object");
84 | }
85 | if (!parent) parent = NO_PARENT;
86 | else if (!isResolve(parent)) {
87 | throw new Error("'parent' must be a promise returned by $resolve.resolve()");
88 | }
89 |
90 | // To complete the overall resolution, we have to wait for the parent
91 | // promise and for the promise for each invokable in our plan.
92 | var resolution = $q.defer(),
93 | result = resolution.promise,
94 | promises = result.$$promises = {},
95 | values = extend({}, locals),
96 | wait = 1 + plan.length/3,
97 | merged = false;
98 |
99 | function done() {
100 | // Merge parent values we haven't got yet and publish our own $$values
101 | if (!--wait) {
102 | if (!merged) merge(values, parent.$$values);
103 | result.$$values = values;
104 | result.$$promises = true; // keep for isResolve()
105 | delete result.$$inheritedValues;
106 | resolution.resolve(values);
107 | }
108 | }
109 |
110 | function fail(reason) {
111 | result.$$failure = reason;
112 | resolution.reject(reason);
113 | }
114 |
115 | // Short-circuit if parent has already failed
116 | if (isDefined(parent.$$failure)) {
117 | fail(parent.$$failure);
118 | return result;
119 | }
120 |
121 | if (parent.$$inheritedValues) {
122 | merge(values, parent.$$inheritedValues);
123 | }
124 |
125 | // Merge parent values if the parent has already resolved, or merge
126 | // parent promises and wait if the parent resolve is still in progress.
127 | if (parent.$$values) {
128 | merged = merge(values, parent.$$values);
129 | result.$$inheritedValues = parent.$$values;
130 | done();
131 | } else {
132 | if (parent.$$inheritedValues) {
133 | result.$$inheritedValues = parent.$$inheritedValues;
134 | }
135 | extend(promises, parent.$$promises);
136 | parent.then(done, fail);
137 | }
138 |
139 | // Process each invocable in the plan, but ignore any where a local of the same name exists.
140 | for (var i=0, ii=plan.length; i
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
46 | ````
47 |
48 | If you'd like you can use Bower to install pusher-angular using the following command:
49 |
50 | ````bash
51 | bower install pusher-angular --save
52 | ````
53 |
54 | With that in place, to start using the AngularJS library you first need to create a `Pusher` client in exactly the same way that you create one using the [pusher-js library](http://github.com/pusher/pusher-js/), which is as follows:
55 |
56 | ````javascript
57 | var pusher = new Pusher(API_KEY);
58 | ````
59 |
60 | There are a number of configuration parameters which can be set for the `Pusher` client, which can be passed as an object to the constructor, i.e.:
61 |
62 | ````javascript
63 | var pusher = new Pusher(API_KEY, {
64 | authEndpoint: "http://example.com/pusher/auth"
65 | });
66 | ````
67 |
68 | This is all documented in full [here](http://github.com/pusher/pusher-js/).
69 |
70 | When you've created a `Pusher` client you then need to pass that client to a `$pusher` object inside your AngularJS controller, service, etc:
71 |
72 | ````javascript
73 | angular.module('myApp').controller('MyController', ['$scope', '$pusher',
74 | function($scope, $pusher) {
75 | var client = new Pusher(API_KEY);
76 | var pusher = $pusher(client);
77 | }]);
78 | ````
79 |
80 | You can also see here that you need to inject the `$pusher` service into any controllers, services, etc where you'd like to use Channels in an AngularJS context.
81 |
82 | To make the `$pusher` service available to be used throughout your app you need to ensure that the `pusher-angular` module is included in your app. You do this by having the following in your app:
83 |
84 | ````javascript
85 | angular.module('myApp', ['pusher-angular'])
86 | ````
87 |
88 | Note that you can choose to define just one `Pusher` client, should you prefer, and then use that as the client throughout your AngularJS app. You can do this by simply instantiating a client as follows:
89 |
90 | ````javascript
91 | window.client = new Pusher('API_KEY');
92 | ````
93 |
94 | and then instantiating instances of `$pusher` in your AngularJS app using the standard:
95 |
96 | ````javascript
97 | var pusher = $pusher(client);
98 | ````
99 |
100 | Make sure that you define client before then referencing it in your AngularJS app though.
101 |
102 | This is all of the setup required to have Channels available in your AngularJS app. The content below will explain how you can utilise Channels in an AngularJS app.
103 |
104 | ## Subscribing to channels
105 |
106 | ### Public channels
107 |
108 | The default method for subscribing to a channel involves invoking the `subscribe` method of your `$pusher` object (named `pusher` throughout the examples provided here):
109 |
110 | ````javascript
111 | var my_channel = pusher.subscribe('my-channel');
112 | ````
113 |
114 | This returns a Channel object which events can be bound to.
115 |
116 | ### Private channels
117 |
118 | Private channels are created in exactly the same way as normal channels, except that they reside in the 'private-' namespace. This means prefixing the channel name:
119 |
120 | ````javascript
121 | var my_private_channel = pusher.subscribe('private-my-channel');
122 | ````
123 |
124 | ### Presence channels
125 |
126 | Presence channels are again created in exactly the same way as normal channels, except that they reside in the 'presence-' namespace. This means prefixing the channel name:
127 |
128 | ````javascript
129 | var my_presence_channel = pusher.subscribe('presence-my-channel');
130 | ````
131 |
132 | It is possible to access channels by name, through the `channel` function:
133 |
134 | ````javascript
135 | channel = pusher.channel('private-my-channel');
136 | ````
137 |
138 | It is possible to access all subscribed channels through the `allChannels` function:
139 |
140 | ````javascript
141 | var channels = pusher.allChannels();
142 | console.group('Channels - subscribed to:');
143 | for (var i = 0; i < channels.length; i++) {
144 | var channel = channels[i];
145 | console.log(channel.name);
146 | }
147 | console.groupEnd();
148 | ````
149 |
150 | ### Encrypted Channels (BETA)
151 |
152 | Like private channels, encrypted channels have their own namespace, 'private-encrypted-'. For more information about encrypted channels, please see the [docs](https://pusher.com/docs/client_api_guide/client_encrypted_channels).
153 |
154 | ```js
155 | var my_private_encrypted_channel = pusher.subscribe('private-encrypted-my-channel');
156 | ```
157 |
158 | ## Accessing Channels
159 |
160 | It is possible to access channels by name, through the `channel` function:
161 |
162 | ```js
163 | var my_private_encrypted_channel = pusher.channel('private-my-channel');
164 | ```
165 |
166 | It is possible to access all subscribed channels through the `allChannels` function:
167 |
168 | ```js
169 | pusher.allChannels().forEach(channel => console.log(channel.name));
170 | ```
171 |
172 | Private, presence and encrypted channels will make a request to your `authEndpoint` (`/pusher/auth`) by default, where you will have to [authenticate the subscription](https://pusher.com/docs/authenticating_users). You will have to send back the correct auth response and a 200 status code.
173 |
174 | ## Binding to events
175 |
176 | Events can be bound to at 2 levels, the global, and per channel. They take a very similar form to the way events are handled in jQuery. Note that this is one area in which the API differs to pusher-js. In pusher-angular, a call to `bind` will return a decorated version of the callback / handler that you pass as a parameter. You will need to assign this to a variable if you wish to unbind the handler from the object in the future. This is explained in the docs for unbinding below.
177 |
178 | ### Global events
179 |
180 | You can attach behaviour to these events regardless of the channel the event is broadcast to. The following is an example of an app that binds to new comments from any channel:
181 |
182 | ````javascript
183 | var client = new Pusher(API_KEY);
184 | var pusher = $pusher(client);
185 | pusher.subscribe('my-channel');
186 | pusher.bind('new-comment',
187 | function(data) {
188 | // add comment into page
189 | }
190 | );
191 | ````
192 |
193 | ### Per-channel events
194 |
195 | These are bound to a specific channel, and mean that you can reuse event names in different parts of your client application. The following might be an example of a stock tracking app where several channels are opened for different companies:
196 |
197 | ````javascript
198 | var client = new Pusher(API_KEY);
199 | var pusher = $pusher(client);
200 | var my_channel = pusher.subscribe('my-channel');
201 | my_channel.bind('new-price',
202 | function(data) {
203 | // update with new price
204 | }
205 | );
206 | ````
207 |
208 | ### Binding to everything
209 |
210 | It is possible to bind to all events at either the global or channel level by using the method `bind_all`. This is used for debugging, but may have other utilities.
211 |
212 | ### Unbind event handlers
213 |
214 | Remove previously-bound handlers from an object. Only handlers that match all of the provided arguments (`eventName`, `handler` or `context`) are removed.
215 |
216 | ````javascript
217 | var handler = function() { console.log('testing'); };
218 | var decoratedHandler = my_channel.bind('new-comment', handler);
219 |
220 | channel.unbind('new-comment', decoratedHandler); // removes just `decoratedHandler` for the `new-comment` event
221 | channel.unbind('new-comment'); // removes all handlers for the `new-comment` event
222 | channel.unbind(null, decoratedHandler); // removes `decoratedHandler` for all events
223 | channel.unbind(null, null, context); // removes all handlers for `context`
224 | channel.unbind(); // removes all handlers on `channel`
225 | ````
226 |
227 | The same API applies to unbinding handlers from the client object.
228 |
229 | ## Presence channel members
230 |
231 | All presence channels have a members object that contains information about all of the members in the channel. More specific information can be found in the [Channels docs](https://pusher.com/docs/channels/using_channels/presence-channels#channel_members).
232 |
233 | In this library the `members` object is setup to automatically reflect changes in members of the channel. That means if you had the following code in a controller:
234 |
235 | ````javascript
236 | angular.module('myApp').controller('MyController', ['$scope', '$pusher',
237 | function($scope, $pusher) {
238 | var client = new Pusher(API_KEY);
239 | var pusher = $pusher(client);
240 |
241 | var presence = pusher.subscribe('presence-test');
242 | $scope.members = presence.members;
243 | }]);
244 | ````
245 |
246 | and the following HTML in your view:
247 |
248 | ````html
249 |
253 | ````
254 |
255 | your view would update the members count and the members list whenever there was a member added or removed from the channel.
256 |
257 |
258 | ## Connection
259 |
260 | You can bind to specific events on your `$pusher` objects connection, such as `state_change`, using the following code:
261 |
262 | ````javascript
263 | var client = new Pusher(API_KEY);
264 | var pusher = $pusher(client);
265 |
266 | pusher.connection.bind('state_change', function (states) {
267 | // var previous = states.previous ...
268 | })
269 | ````
270 |
271 | Similarly to the client and channel, you can also bind to all events on a connection using the `bind_all` method. That looks like this:
272 |
273 | ````javascript
274 | var client = new Pusher(API_KEY);
275 | var pusher = $pusher(client);
276 |
277 | pusher.connection.bind_all(function (eventName, data) {
278 | // if (eventName == 'state_change') { ...
279 | })
280 | ````
281 |
282 |
283 | ## Contributing
284 |
285 | If you'd like to contribute to the library then fork it, hack away at it, improve it, test it, and then make a pull request.
286 |
287 | You can make sure that your changes / improvements don't break anything by running the unit tests. To run them just run `karma start` and then you can go ahead and make changes to the library and the tests and watch the tests run again to see if they're still passing.
288 |
289 | You can generate the minimized file as following:
290 |
291 | ```bash
292 | uglifyjs lib/pusher-angular.js -m -o lib/pusher-angular.min.js
293 | ```
294 |
295 | ## Support
296 |
297 | If you have questions that aren't answered here or in the code's inline documentation then feel free to create an issue describing your problem.
298 |
--------------------------------------------------------------------------------