├── .gitignore
├── .versions
├── LICENSE
├── README.md
├── angular-blaze-template-tests.js
├── angular-blaze-template.js
└── package.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS generated files #
2 | ######################
3 | .DS_Store
4 | .DS_Store?
5 | ._*
6 | .Spotlight-V100
7 | .Trashes
8 | ehthumbs.db
9 | Thumbs.db
10 | .build*
11 |
12 | # IDE's #
13 | #########
14 | .idea
15 |
16 | .meteor/local/bower
17 | .coverage
18 | node_modules
19 | bower_components
--------------------------------------------------------------------------------
/.versions:
--------------------------------------------------------------------------------
1 | angular-blaze-templates-compiler@0.0.1
2 | angular-meteor-data@0.0.4
3 | angular-with-blaze@1.2.0
4 | angular:angular@1.4.7
5 | babel-compiler@5.8.24_1
6 | babel-runtime@0.1.4
7 | base64@1.0.4
8 | binary-heap@1.0.4
9 | blaze@2.1.3
10 | blaze-tools@1.0.4
11 | boilerplate-generator@1.0.4
12 | caching-compiler@1.0.0
13 | caching-html-compiler@1.0.2
14 | callback-hook@1.0.4
15 | check@1.1.0
16 | dburles:mongo-collection-instances@0.3.4
17 | ddp@1.2.2
18 | ddp-client@1.2.1
19 | ddp-common@1.2.2
20 | ddp-server@1.2.2
21 | deps@1.0.9
22 | diff-sequence@1.0.1
23 | ecmascript@0.1.6
24 | ecmascript-runtime@0.2.6
25 | ejson@1.0.7
26 | geojson-utils@1.0.4
27 | html-tools@1.0.5
28 | htmljs@1.0.5
29 | id-map@1.0.4
30 | jquery@1.11.4
31 | lai:collection-extensions@0.1.4
32 | local-test:urigo:angular-blaze-template@0.3.0
33 | logging@1.0.8
34 | meteor@1.1.10
35 | minifiers@1.1.7
36 | minimongo@1.0.10
37 | mongo@1.1.3
38 | mongo-id@1.0.1
39 | npm-mongo@1.4.39_1
40 | observe-sequence@1.0.7
41 | ordered-dict@1.0.4
42 | promise@0.5.1
43 | random@1.0.5
44 | reactive-dict@1.1.3
45 | reactive-var@1.0.6
46 | retry@1.0.4
47 | routepolicy@1.0.6
48 | session@1.1.1
49 | spacebars@1.0.7
50 | spacebars-compiler@1.0.7
51 | templating-tools@1.0.0
52 | tinytest@1.0.6
53 | tracker@1.0.9
54 | ui@1.0.8
55 | underscore@1.0.4
56 | urigo:angular-blaze-template@0.3.0
57 | webapp@1.2.3
58 | webapp-hashing@1.0.5
59 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Uri Goldshtein
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
[urigo:angular-blaze-template](http://angular-meteor.com/api/blaze-template)
2 | ======================================================
3 |
4 | ### <blaze-template>
5 |
6 | Include Blaze templates in your [angular-meteor](http://angular-meteor.com/) application.
7 |
8 | ### Quick start
9 |
10 | In the command line: `$ meteor add urigo:angular-blaze-template`
11 |
12 | You can include Meteor's Blaze native templates with the [blaze-template](http://angular-meteor.com/api/blaze-template) directive.
13 |
14 | ```html
15 |
16 | A couple of todos
17 |
18 |
19 |
20 | ```
21 |
22 | ### `replace` directive with template content
23 | Sometimes, the page styling or logic could strictly depend on the DOM tree
24 | depth level where the template elements are located. The directive element
25 | could be replaced with the contents of the template using the attribute
26 | `replace` as follows:
27 |
28 | ```html
29 |
30 | ```
31 |
32 | **WARNING:** If `replace` is used, the original directive DOM element will
33 | be completely removed and replaced with the content of the template. Therefore,
34 | it will not be possible to use replace in combination with any other
35 | directive, like `ng-if` or `ng-switch`.
36 |
37 | ### Next steps
38 | Read more on blaze-template, using parameters and binding Blaze templates to Angular's scope in the [API docs](http://angular-meteor.com/api/blaze-template).
39 |
--------------------------------------------------------------------------------
/angular-blaze-template-tests.js:
--------------------------------------------------------------------------------
1 | // Write your tests here!
2 | // Here is an example.
3 | Tinytest.add('example', function (test) {
4 | test.equal(true, true);
5 | });
6 |
--------------------------------------------------------------------------------
/angular-blaze-template.js:
--------------------------------------------------------------------------------
1 | var angularMeteorTemplate = angular.module('angular-blaze-template', []);
2 |
3 | // blaze-template adds Blaze templates to Angular as directives
4 | angularMeteorTemplate.directive('blazeTemplate', [
5 | '$compile',
6 | function ($compile) {
7 | return {
8 | restrict: 'AE',
9 | scope: false,
10 | link: function (scope, element, attributes) {
11 | // Check if templating and Blaze package exist, they won't exist in a
12 | // Meteor Client Side (https://github.com/idanwe/meteor-client-side) application
13 | if (Template && Package['blaze']){
14 |
15 | var name = attributes.blazeTemplate || attributes.name;
16 | if (name && Template[name]) {
17 |
18 | var template = Template[name],
19 | viewHandler;
20 |
21 | if (typeof attributes['replace'] !== 'undefined') {
22 | viewHandler = Blaze.
23 | renderWithData(template, scope, element.parent()[0], element[0]);
24 | element.remove();
25 | } else {
26 | viewHandler = Blaze.renderWithData(template, scope, element[0]);
27 | $compile(element.contents())(scope);
28 | element.find().unwrap();
29 | }
30 |
31 | scope.$on('$destroy', function() {
32 | Blaze.remove(viewHandler);
33 | });
34 |
35 | } else {
36 | console.error("meteorTemplate: There is no template with the name '" + name + "'");
37 | }
38 | }
39 | }
40 | };
41 | }
42 | ]);
43 |
44 | var angularMeteorModule = angular.module('angular-meteor');
45 | angularMeteorModule.requires.push('angular-blaze-template');
46 |
--------------------------------------------------------------------------------
/package.js:
--------------------------------------------------------------------------------
1 | Package.describe({
2 | name: 'urigo:angular-blaze-template',
3 | version: '0.3.0',
4 | summary: 'Include Blaze templates in your angular-meteor application.',
5 | git: 'https://github.com/Urigo/angular-blaze-template',
6 | documentation: 'README.md'
7 | });
8 |
9 | Package.onUse(function(api) {
10 | api.versionsFrom('1.1.0.3');
11 | api.use('angular-with-blaze@1.2.0', 'client');
12 | api.addFiles('angular-blaze-template.js', 'client');
13 | });
14 |
15 | Package.onTest(function(api) {
16 | api.use('tinytest');
17 | api.use('urigo:angular-blaze-template');
18 | api.addFiles('angular-blaze-template-tests.js');
19 | });
20 |
--------------------------------------------------------------------------------