angular_sprinkles 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +9 -8
- data/Gemfile.lock +41 -13
- data/LICENSE.txt +1 -1
- data/README.md +4 -38
- data/Rakefile +20 -37
- data/VERSION +1 -1
- data/angular_sprinkles.gemspec +104 -41
- data/app/assets/javascripts/angular_sprinkles.js.erb +1 -22
- data/lib/angular_sprinkles/constructor.rb +12 -0
- data/lib/angular_sprinkles/constructor_collection.rb +20 -0
- data/lib/angular_sprinkles/content_cache.rb +15 -0
- data/lib/angular_sprinkles/content_yielder.rb +19 -0
- data/lib/angular_sprinkles/context.rb +13 -0
- data/lib/angular_sprinkles/controller.rb +38 -65
- data/lib/angular_sprinkles/counter.rb +12 -0
- data/lib/angular_sprinkles/directive/attributes.rb +16 -0
- data/lib/angular_sprinkles/directive/input.rb +19 -0
- data/lib/angular_sprinkles/directive/name.rb +19 -0
- data/lib/angular_sprinkles/directive/options.rb +13 -0
- data/lib/angular_sprinkles/helpers/directive_helper.rb +7 -20
- data/lib/angular_sprinkles/helpers/service_helper.rb +14 -0
- data/lib/angular_sprinkles/helpers.rb +2 -7
- data/lib/angular_sprinkles/java_script.rb +55 -0
- data/lib/angular_sprinkles/key_generator.rb +14 -0
- data/lib/angular_sprinkles/model_decorator.rb +16 -0
- data/lib/angular_sprinkles/object_key_wrapper.rb +12 -0
- data/lib/angular_sprinkles.rb +20 -14
- data/spec/angular_sprinkles/constructor_collection_spec.rb +22 -0
- data/spec/angular_sprinkles/constructor_spec.rb +12 -0
- data/spec/angular_sprinkles/content_cache_spec.rb +15 -0
- data/spec/angular_sprinkles/content_yielder_spec.rb +45 -0
- data/spec/angular_sprinkles/context_spec.rb +22 -0
- data/spec/angular_sprinkles/counter_spec.rb +15 -0
- data/spec/angular_sprinkles/directive/attributes_spec.rb +24 -0
- data/spec/angular_sprinkles/directive/input_spec.rb +11 -0
- data/spec/angular_sprinkles/directive/name_spec.rb +11 -0
- data/spec/angular_sprinkles/directive/options_spec.rb +11 -0
- data/spec/angular_sprinkles/key_generator_spec.rb +17 -0
- data/spec/angular_sprinkles/model_decorator_spec.rb +24 -0
- data/spec/angular_sprinkles/object_key_wrapper_spec.rb +17 -0
- data/spec/controllers/test_controller_spec.rb +20 -0
- data/spec/dummy/.rspec +3 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +30 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/test_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/test_model.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/app/views/test/new.html.erb +9 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +29 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +82 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +57 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20140908021353_create_test_models.rb +9 -0
- data/spec/dummy/db/schema.rb +22 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/features/javascript_spec.rb +26 -0
- data/spec/rails_helper.rb +21 -0
- data/spec/spec_helper.rb +82 -21
- metadata +103 -29
- data/.document +0 -5
- data/.rspec +0 -1
- data/lib/angular_sprinkles/data/bind.rb +0 -18
- data/lib/angular_sprinkles/decorators/bind_decorator.rb +0 -61
- data/lib/angular_sprinkles/decorators.rb +0 -6
- data/lib/angular_sprinkles/helpers/bind_helper.rb +0 -56
- data/lib/angular_sprinkles/helpers/bind_service_helper.rb +0 -27
- data/lib/angular_sprinkles/mixins/cache.rb +0 -11
- data/lib/angular_sprinkles/mixins/js_transformable.rb +0 -27
- data/lib/angular_sprinkles/variable_cache.rb +0 -19
- data/spec/controller_spec.rb +0 -74
- data/spec/data/bind_spec.rb +0 -11
- data/spec/decorators/bind_decorator_spec.rb +0 -56
- data/spec/helpers/bind_helper_spec.rb +0 -94
- data/spec/helpers/directive_helper_spec.rb +0 -66
- data/spec/mixins/js_transformable_spec.rb +0 -45
- data/spec/variable_cache_spec.rb +0 -57
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module AngularSprinkles
|
|
2
|
+
class ModelDecorator < SimpleDelegator
|
|
3
|
+
def initialize(args)
|
|
4
|
+
@key = args.fetch(:key)
|
|
5
|
+
@json_wrapper = args.fetch(:json_wrapper)
|
|
6
|
+
@object_wrapper = args.fetch(:object_wrapper)
|
|
7
|
+
|
|
8
|
+
object = args.fetch(:object)
|
|
9
|
+
super(object)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def bind(attribute = nil)
|
|
13
|
+
@object_wrapper.new(@key, attribute, @json_wrapper)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/angular_sprinkles.rb
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
require
|
|
10
|
-
require
|
|
11
|
-
require
|
|
12
|
-
require
|
|
13
|
-
require
|
|
14
|
-
require
|
|
1
|
+
require "angular_sprinkles/constructor"
|
|
2
|
+
require "angular_sprinkles/constructor_collection"
|
|
3
|
+
require "angular_sprinkles/content_cache"
|
|
4
|
+
require "angular_sprinkles/content_yielder"
|
|
5
|
+
require "angular_sprinkles/directive/attributes"
|
|
6
|
+
require "angular_sprinkles/directive/input"
|
|
7
|
+
require "angular_sprinkles/directive/name"
|
|
8
|
+
require "angular_sprinkles/directive/options"
|
|
9
|
+
require "angular_sprinkles/context"
|
|
10
|
+
require "angular_sprinkles/controller"
|
|
11
|
+
require "angular_sprinkles/counter"
|
|
12
|
+
require "angular_sprinkles/engine"
|
|
13
|
+
require "angular_sprinkles/helpers/directive_helper"
|
|
14
|
+
require "angular_sprinkles/helpers/service_helper"
|
|
15
|
+
require "angular_sprinkles/helpers"
|
|
16
|
+
require "angular_sprinkles/java_script"
|
|
17
|
+
require "angular_sprinkles/key_generator"
|
|
18
|
+
require "angular_sprinkles/model_decorator"
|
|
19
|
+
require "angular_sprinkles/object_key_wrapper"
|
|
20
|
+
require "angular_sprinkles/railtie"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AngularSprinkles::ConstructorCollection do
|
|
4
|
+
let(:json_wrapper) { ->{} }
|
|
5
|
+
let(:object_wrapper) { Object.new }
|
|
6
|
+
|
|
7
|
+
let(:stub) { "stub" }
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
allow(object_wrapper).to receive(:new).and_return(stub)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
subject { described_class.new(json_wrapper: json_wrapper, object_wrapper: object_wrapper) }
|
|
14
|
+
|
|
15
|
+
it 'turns objects into a wrapped js string' do
|
|
16
|
+
# add two items to the collection
|
|
17
|
+
subject.push(1, 2)
|
|
18
|
+
subject.push(1, 2)
|
|
19
|
+
|
|
20
|
+
expect(subject.to_json).to eq("#{stub.to_json}\n#{stub.to_json}")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AngularSprinkles::Constructor do
|
|
4
|
+
let(:wrapper) { ->(string){ "%%#{string}%%" } }
|
|
5
|
+
let(:collection) { [] }
|
|
6
|
+
|
|
7
|
+
subject { described_class.new(json_wrapper: wrapper, collection: collection) }
|
|
8
|
+
|
|
9
|
+
it 'turns objects into a wrapped js string' do
|
|
10
|
+
expect(subject.to_json).to include("%%#{collection.to_json}%%")
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AngularSprinkles::ContentCache do
|
|
4
|
+
let(:key) { 'key' }
|
|
5
|
+
|
|
6
|
+
subject { described_class.new }
|
|
7
|
+
|
|
8
|
+
it 'can set a key' do
|
|
9
|
+
expect(subject.set?(key)).to eq(false)
|
|
10
|
+
|
|
11
|
+
subject.set(key)
|
|
12
|
+
|
|
13
|
+
expect(subject.set?(key)).to eq(true)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AngularSprinkles::ContentYielder do
|
|
4
|
+
let(:context) { ActionController::Base.new.view_context }
|
|
5
|
+
let(:cache) { Object.new }
|
|
6
|
+
let(:yield_to) { :yield_to }
|
|
7
|
+
let(:content) { 'content' }
|
|
8
|
+
|
|
9
|
+
subject { described_class.new(context: context, cache: cache, yield_to: yield_to) }
|
|
10
|
+
|
|
11
|
+
before do
|
|
12
|
+
allow(cache).to receive(:set).and_return(true)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
context "when the content hasn't yet been set" do
|
|
16
|
+
let(:script_tag) { "<script>#{content.to_json}</script>" }
|
|
17
|
+
|
|
18
|
+
before do
|
|
19
|
+
allow(cache).to receive(:set?).and_return(false)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'returns a script tag' do
|
|
23
|
+
expect(subject.call(content)).to eq(script_tag)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'appends the content to sprinkles' do
|
|
27
|
+
# this is an important side effect
|
|
28
|
+
expect(context).
|
|
29
|
+
to receive(:content_for).with(yield_to, script_tag)
|
|
30
|
+
|
|
31
|
+
subject.call(content)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context "when the content has been set" do
|
|
36
|
+
before do
|
|
37
|
+
allow(cache).to receive(:set?).and_return(true)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'returns an empty string' do
|
|
41
|
+
expect(subject.call(content)).to eq('')
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AngularSprinkles::Context do
|
|
4
|
+
let(:key_generator) { Object.new }
|
|
5
|
+
let(:constructor) { Object.new }
|
|
6
|
+
let(:constructor_collection) { Object.new }
|
|
7
|
+
let(:view_context) { Object.new }
|
|
8
|
+
|
|
9
|
+
subject do
|
|
10
|
+
described_class.new({
|
|
11
|
+
key_generator: key_generator,
|
|
12
|
+
constructor_collection: constructor_collection,
|
|
13
|
+
constructor: constructor
|
|
14
|
+
})
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'initializes a context wrapper' do
|
|
18
|
+
expect(subject.key_generator).to be(key_generator)
|
|
19
|
+
expect(subject.constructor).to be(constructor)
|
|
20
|
+
expect(subject.constructor_collection).to be(constructor_collection)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AngularSprinkles::Counter do
|
|
4
|
+
|
|
5
|
+
subject { described_class.new }
|
|
6
|
+
|
|
7
|
+
it 'increments the counter for classes' do
|
|
8
|
+
expect(subject.inc(Object)).to eq(1)
|
|
9
|
+
expect(subject.inc(Object)).to eq(2)
|
|
10
|
+
expect(subject.inc(Array)).to eq(1)
|
|
11
|
+
expect(subject.inc(Array)).to eq(2)
|
|
12
|
+
expect(subject.inc(Array)).to eq(3)
|
|
13
|
+
expect(subject.inc(described_class)).to eq(1)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AngularSprinkles::Directive::Attributes do
|
|
4
|
+
let(:stub) { Object.new }
|
|
5
|
+
|
|
6
|
+
let(:name) { stub }
|
|
7
|
+
let(:input) { stub }
|
|
8
|
+
let(:options) { stub }
|
|
9
|
+
let(:content) { 'content' }
|
|
10
|
+
let(:tag) { :div }
|
|
11
|
+
|
|
12
|
+
before do
|
|
13
|
+
allow(stub).to receive(:attributes).and_return({})
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
subject do
|
|
17
|
+
described_class.new([name, input, options], content: content, tag: tag)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'returns the list of arguments required for the content_tag' do
|
|
21
|
+
expect(subject.to_content_tag).to eq([tag, content, {}])
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AngularSprinkles::Directive::Input do
|
|
4
|
+
let(:args) { { key: 'value' } }
|
|
5
|
+
|
|
6
|
+
subject { described_class.new(args) }
|
|
7
|
+
|
|
8
|
+
it 'turns the args hash into a jsonified data hash' do
|
|
9
|
+
expect(subject.attributes).to eq({ data: { key: "\"value\"" } })
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AngularSprinkles::Directive::Name do
|
|
4
|
+
let(:args) { [:first, :second, :third] }
|
|
5
|
+
|
|
6
|
+
subject { described_class.new(args) }
|
|
7
|
+
|
|
8
|
+
it 'turns the args hash into an empty data hash' do
|
|
9
|
+
expect(subject.attributes).to eq({ data: { first: '', second: '', third: '' } })
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AngularSprinkles::KeyGenerator do
|
|
4
|
+
let(:counter) { Object.new }
|
|
5
|
+
let(:inc) { 1 }
|
|
6
|
+
let(:object) { Object.new }
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(counter).to receive(:inc).with(object.class).and_return(inc)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
subject { described_class.new(counter: counter) }
|
|
13
|
+
|
|
14
|
+
it 'returns a suitable variable name' do
|
|
15
|
+
expect(subject.call(object)).to eq("#{object.class}_#{inc}")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AngularSprinkles::ModelDecorator do
|
|
4
|
+
let(:key) { 'key' }
|
|
5
|
+
let(:object) { Object.new }
|
|
6
|
+
let(:attribute) { :a }
|
|
7
|
+
let(:json_wrapper) { ->(key, attribute) { "#{key}+#{attribute}"} }
|
|
8
|
+
let(:object_wrapper) { Array }
|
|
9
|
+
|
|
10
|
+
subject do
|
|
11
|
+
described_class.new(key: key, object: object, json_wrapper: json_wrapper, object_wrapper: object_wrapper)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe "#bind" do
|
|
15
|
+
it 'returns a binding object' do
|
|
16
|
+
expect(object_wrapper).to receive(:new).with(key, attribute, json_wrapper)
|
|
17
|
+
subject.bind(attribute)
|
|
18
|
+
|
|
19
|
+
expect(object_wrapper).to receive(:new).with(key, nil, json_wrapper)
|
|
20
|
+
subject.bind
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AngularSprinkles::ObjectKeyWrapper do
|
|
4
|
+
let(:wrapper1) { ->(a) { "%%#{a}%%" } }
|
|
5
|
+
let(:wrapper2) { ->(a, b) { "#{a}+#{b}" } }
|
|
6
|
+
|
|
7
|
+
let(:arg1) { "a" }
|
|
8
|
+
let(:arg2) { "b" }
|
|
9
|
+
|
|
10
|
+
it 'wraps objects on #to_json' do
|
|
11
|
+
json1 = described_class.new(arg1, wrapper1).to_json
|
|
12
|
+
expect(json1).to eq("%%#{arg1}%%")
|
|
13
|
+
|
|
14
|
+
json2 = described_class.new(arg1, arg2, wrapper2).to_json
|
|
15
|
+
expect(json2).to eq("#{arg1}+#{arg2}")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe TestController do
|
|
4
|
+
render_views
|
|
5
|
+
|
|
6
|
+
let(:name) { "name" }
|
|
7
|
+
|
|
8
|
+
subject { get :new, { name: name }}
|
|
9
|
+
|
|
10
|
+
it "renders the view with the correct bindings" do
|
|
11
|
+
model_name = "TestModel_1"
|
|
12
|
+
attr_binding = "#{model_name}.name"
|
|
13
|
+
|
|
14
|
+
model_match = subject.body.scan(model_name)
|
|
15
|
+
attr_match = subject.body.scan(attr_binding)
|
|
16
|
+
|
|
17
|
+
expect(model_match.count).to eq(5)
|
|
18
|
+
expect(attr_match.count).to eq(4)
|
|
19
|
+
end
|
|
20
|
+
end
|
data/spec/dummy/.rspec
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
== README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
|
28
|
+
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
ADDED
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require angular
|
|
14
|
+
//= require angular_sprinkles
|
|
15
|
+
//= require_tree .
|
|
16
|
+
|
|
17
|
+
sprinkles.service('helloWorld', function () {
|
|
18
|
+
return function (input) {
|
|
19
|
+
return "Hello " + input;
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
sprinkles.directive('nestedDirective', function () {
|
|
24
|
+
return {
|
|
25
|
+
scope: {
|
|
26
|
+
name: '='
|
|
27
|
+
},
|
|
28
|
+
template: '<h2>{{name}}</h2>'
|
|
29
|
+
};
|
|
30
|
+
});
|