├── .gitattributes
├── .github
└── issue_template.md
├── .gitignore
├── LICENSE.md
├── MVC5Angular2.sln
├── MVC5Angular2
├── App
│ ├── app.component.css
│ ├── app.component.html
│ ├── app.component.js
│ ├── app.component.js.map
│ ├── app.component.ts
│ ├── app.module.js
│ ├── app.module.ts
│ ├── app.routing.js
│ ├── app.routing.ts
│ ├── assets
│ │ └── images
│ │ │ ├── garden_cart.png
│ │ │ └── rejon_Hammer.png
│ ├── home
│ │ ├── welcome.component.html
│ │ ├── welcome.component.js
│ │ ├── welcome.component.js.map
│ │ └── welcome.component.ts
│ ├── index.html
│ ├── main.js.map
│ ├── main.ts
│ ├── polyfills.js.map
│ ├── polyfills.ts
│ ├── products
│ │ ├── product-detail.component.html
│ │ ├── product-detail.component.js
│ │ ├── product-detail.component.js.map
│ │ ├── product-detail.component.ts
│ │ ├── product-filter.pipe.js
│ │ ├── product-filter.pipe.js.map
│ │ ├── product-filter.pipe.ts
│ │ ├── product-form.component.html
│ │ ├── product-form.component.js
│ │ ├── product-form.component.js.map
│ │ ├── product-form.component.ts
│ │ ├── product-list.component.css
│ │ ├── product-list.component.html
│ │ ├── product-list.component.js
│ │ ├── product-list.component.js.map
│ │ ├── product-list.component.ts
│ │ ├── product.js
│ │ ├── product.js.map
│ │ ├── product.service.js
│ │ ├── product.service.js.map
│ │ ├── product.service.ts
│ │ └── product.ts
│ ├── shared
│ │ ├── star.component.css
│ │ ├── star.component.html
│ │ ├── star.component.js
│ │ ├── star.component.js.map
│ │ └── star.component.ts
│ ├── users
│ │ ├── Result.js.map
│ │ ├── emailValidators.js
│ │ ├── emailValidators.js.map
│ │ ├── emailValidators.ts
│ │ ├── result.js
│ │ ├── result.ts
│ │ ├── signup-form.component.html
│ │ ├── signup-form.component.js
│ │ ├── signup-form.component.js.map
│ │ ├── signup-form.component.ts
│ │ ├── user.js
│ │ ├── user.js.map
│ │ ├── user.service.js
│ │ ├── user.service.js.map
│ │ ├── user.service.ts
│ │ ├── user.ts
│ │ ├── usernameValidators.js
│ │ ├── usernameValidators.js.map
│ │ └── usernameValidators.ts
│ ├── using-jquery-addons
│ │ ├── using-jquery-addons.component.html
│ │ ├── using-jquery-addons.component.js
│ │ ├── using-jquery-addons.component.js.map
│ │ └── using-jquery-addons.component.ts
│ ├── using-third-party-libraries
│ │ ├── typed-sha.component.html
│ │ ├── typed-sha.component.js
│ │ ├── typed-sha.component.js.map
│ │ ├── typed-sha.component.ts
│ │ ├── untyped-sha.component.html
│ │ ├── untyped-sha.component.js
│ │ ├── untyped-sha.component.js.map
│ │ └── untyped-sha.component.ts
│ ├── vendor.js
│ ├── vendor.js.map
│ └── vendor.ts
├── App_Start
│ └── RouteConfig.cs
├── Content
│ └── Site.css
├── Controllers
│ └── HomeController.cs
├── Global.asax
├── Global.asax.cs
├── MVC5Angular2.csproj
├── Models
│ ├── Product.cs
│ └── User.cs
├── Properties
│ └── AssemblyInfo.cs
├── Views
│ ├── Home
│ │ └── Index.cshtml
│ ├── Shared
│ │ ├── _LayoutGulp.cshtml
│ │ └── _LayoutSystemJs.cshtml
│ ├── _ViewStart.cshtml
│ └── web.config
├── Web.config
├── bower.json
├── config
│ ├── helpers.js
│ ├── karma-test-shim.js
│ ├── karma.conf.js
│ ├── webpack.common.js
│ ├── webpack.dev.js
│ ├── webpack.prod.js
│ └── webpack.test.js
├── favicon.ico
├── gulpfile.js
├── karma.conf.js
├── package.json
├── packages.config
├── systemjs.config.js
├── tsconfig.json
├── tslint.json
└── webpack.config.js
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/issue_template.md:
--------------------------------------------------------------------------------
1 | # Summary of the issue
2 |
3 |
4 |
5 | ## Environment
6 |
7 | ```
8 | The in-use version:
9 | Operating system:
10 | IDE: (e.g. Visual Studio 2015)
11 | ```
12 |
13 | ## Example code/Steps to reproduce:
14 |
15 | ```
16 | paste your core code
17 | ```
18 |
19 | ## Output:
20 |
21 | ```
22 | Exception message:
23 | Full Stack trace:
24 | ```
25 |
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 | *.zip
10 | *.map
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | [Xx]64/
21 | [Xx]86/
22 | [Bb]uild/
23 | bld/
24 | [Bb]in/
25 | [Oo]bj/
26 |
27 | # Visual Studio 2015 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # MSTest test Results
33 | [Tt]est[Rr]esult*/
34 | [Bb]uild[Ll]og.*
35 |
36 | # NUNIT
37 | *.VisualState.xml
38 | TestResult.xml
39 |
40 | # Build Results of an ATL Project
41 | [Dd]ebugPS/
42 | [Rr]eleasePS/
43 | dlldata.c
44 |
45 | # DNX
46 | project.lock.json
47 | artifacts/
48 |
49 | *_i.c
50 | *_p.c
51 | *_i.h
52 | *.ilk
53 | *.meta
54 | *.obj
55 | *.pch
56 | *.pdb
57 | *.pgc
58 | *.pgd
59 | *.rsp
60 | *.sbr
61 | *.tlb
62 | *.tli
63 | *.tlh
64 | *.tmp
65 | *.tmp_proj
66 | *.log
67 | *.vspscc
68 | *.vssscc
69 | .builds
70 | *.pidb
71 | *.svclog
72 | *.scc
73 |
74 | # Chutzpah Test files
75 | _Chutzpah*
76 |
77 | # Visual C++ cache files
78 | ipch/
79 | *.aps
80 | *.ncb
81 | *.opendb
82 | *.opensdf
83 | *.sdf
84 | *.cachefile
85 | *.VC.db
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 |
145 | # TODO: Un-comment the next line if you do not want to checkin
146 | # your web deploy settings because they may include unencrypted
147 | # passwords
148 | #*.pubxml
149 | *.publishproj
150 |
151 | # NuGet Packages
152 | *.nupkg
153 | # The packages folder can be ignored because of Package Restore
154 | **/packages/*
155 | # except build/, which is used as an MSBuild target.
156 | !**/packages/build/
157 | # Uncomment if necessary however generally it will be regenerated when needed
158 | #!**/packages/repositories.config
159 | # NuGet v3's project.json files produces more ignoreable files
160 | *.nuget.props
161 | *.nuget.targets
162 |
163 | # Microsoft Azure Build Output
164 | csx/
165 | *.build.csdef
166 |
167 | # Microsoft Azure Emulator
168 | ecf/
169 | rcf/
170 |
171 | # Microsoft Azure ApplicationInsights config file
172 | ApplicationInsights.config
173 |
174 | # Windows Store app package directory
175 | AppPackages/
176 | BundleArtifacts/
177 |
178 | # Visual Studio cache files
179 | # files ending in .cache can be ignored
180 | *.[Cc]ache
181 | # but keep track of directories ending in .cache
182 | !*.[Cc]ache/
183 |
184 | # Others
185 | ClientBin/
186 | [Ss]tyle[Cc]op.*
187 | ~$*
188 | *~
189 | *.dbmdl
190 | *.dbproj.schemaview
191 | *.pfx
192 | *.publishsettings
193 | node_modules/
194 | bower_components/
195 | orleans.codegen.cs
196 | wwwroot/
197 | dist/
198 |
199 | # RIA/Silverlight projects
200 | Generated_Code/
201 |
202 | # Backup & report files from converting an old project file
203 | # to a newer Visual Studio version. Backup files are not needed,
204 | # because we have git ;-)
205 | _UpgradeReport_Files/
206 | Backup*/
207 | UpgradeLog*.XML
208 | UpgradeLog*.htm
209 |
210 | # SQL Server files
211 | *.mdf
212 | *.ldf
213 |
214 | # Business Intelligence projects
215 | *.rdl.data
216 | *.bim.layout
217 | *.bim_*.settings
218 |
219 | # Microsoft Fakes
220 | FakesAssemblies/
221 |
222 | # GhostDoc plugin setting file
223 | *.GhostDoc.xml
224 |
225 | # Node.js Tools for Visual Studio
226 | .ntvs_analysis.dat
227 |
228 | # Visual Studio 6 build log
229 | *.plg
230 |
231 | # Visual Studio 6 workspace options file
232 | *.opt
233 |
234 | # Visual Studio LightSwitch build output
235 | **/*.HTMLClient/GeneratedArtifacts
236 | **/*.DesktopClient/GeneratedArtifacts
237 | **/*.DesktopClient/ModelManifest.xml
238 | **/*.Server/GeneratedArtifacts
239 | **/*.Server/ModelManifest.xml
240 | _Pvt_Extensions
241 |
242 | # LightSwitch generated files
243 | GeneratedArtifacts/
244 | ModelManifest.xml
245 |
246 | # Paket dependency manager
247 | .paket/paket.exe
248 |
249 | # FAKE - F# Make
250 | .fake/
251 | /MVC5Angular2/App/*.js
252 | /MVC5Angular2/App/*.map
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/MVC5Angular2.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25123.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVC5Angular2", "MVC5Angular2\MVC5Angular2.csproj", "{2D3B9969-C179-46E5-B9A7-60FE5025FB17}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{72F6B0B4-4F7C-481F-AFF6-873BC87CDEE2}"
9 | ProjectSection(SolutionItems) = preProject
10 | LICENSE.md = LICENSE.md
11 | README.md = README.md
12 | EndProjectSection
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Release|Any CPU = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {2D3B9969-C179-46E5-B9A7-60FE5025FB17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {2D3B9969-C179-46E5-B9A7-60FE5025FB17}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {2D3B9969-C179-46E5-B9A7-60FE5025FB17}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {2D3B9969-C179-46E5-B9A7-60FE5025FB17}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/MVC5Angular2/App/app.component.css:
--------------------------------------------------------------------------------
1 | li {
2 | font-size: large;
3 | }
4 |
5 | div.panel-heading {
6 | font-size: x-large;
7 | }
8 |
9 | .ng-touched.ng-invalid{
10 | border: 1px solid red;
11 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{pageTitle}}
8 |
9 |
10 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/MVC5Angular2/App/app.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | Object.defineProperty(exports, "__esModule", { value: true });
9 | var core_1 = require("@angular/core");
10 | require("rxjs/Rx"); // require('rxjs/Rx'); // Load all features
11 | //import 'jssha'; // require('jssha');
12 | var product_service_1 = require("./products/product.service");
13 | //for webpack
14 | //import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
15 | var AppComponent = (function () {
16 | function AppComponent() {
17 | this.pageTitle = "DNT AngularJS 2.0 APP";
18 | }
19 | return AppComponent;
20 | }());
21 | AppComponent = __decorate([
22 | core_1.Component({
23 | selector: 'pm-app',
24 | //template: require('./app.component.html'), //for webpack
25 | templateUrl: "/app/app.component.html",
26 | providers: [
27 | product_service_1.ProductService
28 | ]
29 | })
30 | ], AppComponent);
31 | exports.AppComponent = AppComponent;
32 | //# sourceMappingURL=app.component.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/app.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"app.component.js","sourceRoot":"","sources":["app.component.ts"],"names":[],"mappings":";;;;;;;;AAAA,sCAA0C;AAC1C,mBAAiB,CAAC,2CAA2C;AAC7D,sCAAsC;AAEtC,8DAA4D;AAE5D,aAAa;AACb,gEAAgE;AAWhE,IAAa,YAAY;IARzB;QASI,cAAS,GAAW,uBAAuB,CAAC;IAChD,CAAC;IAAD,mBAAC;AAAD,CAAC,AAFD,IAEC;AAFY,YAAY;IARxB,gBAAS,CAAC;QACP,QAAQ,EAAE,QAAQ;QAClB,0DAA0D;QAC1D,WAAW,EAAE,yBAAyB;QACtC,SAAS,EAAE;YACP,gCAAc;SACjB;KACJ,CAAC;GACW,YAAY,CAExB;AAFY,oCAAY"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 | import 'rxjs/Rx'; // require('rxjs/Rx'); // Load all features
3 | //import 'jssha'; // require('jssha');
4 |
5 | import { ProductService } from './products/product.service';
6 |
7 | //for webpack
8 | //import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
9 |
10 |
11 | @Component({
12 | selector: 'pm-app',
13 | //template: require('./app.component.html'), //for webpack
14 | templateUrl: "/app/app.component.html",
15 | providers: [
16 | ProductService
17 | ]
18 | })
19 | export class AppComponent {
20 | pageTitle: string = "DNT AngularJS 2.0 APP";
21 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/app.module.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | Object.defineProperty(exports, "__esModule", { value: true });
9 | var core_1 = require("@angular/core");
10 | var platform_browser_1 = require("@angular/platform-browser");
11 | var forms_1 = require("@angular/forms");
12 | var http_1 = require("@angular/http");
13 | var app_component_1 = require("./app.component");
14 | var app_routing_1 = require("./app.routing");
15 | var product_filter_pipe_1 = require("./products/product-filter.pipe");
16 | var star_component_1 = require("./shared/star.component");
17 | var AppModule = (function () {
18 | function AppModule() {
19 | }
20 | return AppModule;
21 | }());
22 | AppModule = __decorate([
23 | core_1.NgModule({
24 | imports: [
25 | // module dependencies
26 | platform_browser_1.BrowserModule,
27 | forms_1.FormsModule,
28 | forms_1.ReactiveFormsModule,
29 | http_1.HttpModule,
30 | app_routing_1.AppRoutingModule
31 | ],
32 | declarations: [
33 | // components and directives
34 | app_component_1.AppComponent,
35 | star_component_1.StarComponent,
36 | //You have to declare the components used in the routes in the NgModule.
37 | app_routing_1.routingComponents,
38 | //Pipes
39 | product_filter_pipe_1.ProductFilterPipe
40 | ],
41 | bootstrap: [
42 | // root component
43 | app_component_1.AppComponent
44 | ],
45 | providers: []
46 | })
47 | ], AppModule);
48 | exports.AppModule = AppModule;
49 | //# sourceMappingURL=app.module.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/app.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { BrowserModule } from '@angular/platform-browser';
3 | import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4 | import { HttpModule } from '@angular/http';
5 |
6 | import { AppComponent } from './app.component';
7 | import { AppRoutingModule, routingComponents } from './app.routing';
8 |
9 | import { ProductListComponent } from "./products/product-list.component";
10 | import { WelcomeComponent } from "./home/welcome.component";
11 | import { ProductDetailComponent } from "./products/product-detail.component";
12 | import { ProductFormComponent } from "./products/product-form.component";
13 | import { SignupFormComponent } from "./users/signup-form.component";
14 | import { TypedShaComponent } from "./using-third-party-libraries/typed-sha.component";
15 | import { UnTypedShaComponent } from "./using-third-party-libraries/untyped-sha.component";
16 | import { UsingJQueryAddonsComponent } from "./using-jquery-addons/using-jquery-addons.component";
17 | import { ProductFilterPipe } from './products/product-filter.pipe';
18 | import { StarComponent } from './shared/star.component';
19 |
20 | @NgModule({
21 | imports: [
22 | // module dependencies
23 | BrowserModule,
24 | FormsModule,
25 | ReactiveFormsModule,
26 | HttpModule,
27 | AppRoutingModule
28 | ],
29 | declarations: [ // You can optionally move your directives declarations from @Component to @NgModule
30 | // components and directives
31 | AppComponent,
32 | StarComponent,
33 |
34 | //You have to declare the components used in the routes in the NgModule.
35 | routingComponents,
36 |
37 | //Pipes
38 | ProductFilterPipe
39 | ],
40 | bootstrap: [
41 | // root component
42 | AppComponent
43 | ],
44 | providers: [ // You can optionally move your providers declarations from @Component to @NgModule
45 | // services
46 | ]
47 | })
48 |
49 | export class AppModule { }
--------------------------------------------------------------------------------
/MVC5Angular2/App/app.routing.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | Object.defineProperty(exports, "__esModule", { value: true });
9 | // - Routes instead of RouteConfig
10 | // - RouterModule instead of provideRoutes
11 | var router_1 = require("@angular/router");
12 | var core_1 = require("@angular/core");
13 | var product_list_component_1 = require("./products/product-list.component");
14 | var welcome_component_1 = require("./home/welcome.component");
15 | var product_detail_component_1 = require("./products/product-detail.component");
16 | var product_form_component_1 = require("./products/product-form.component");
17 | var signup_form_component_1 = require("./users/signup-form.component");
18 | var typed_sha_component_1 = require("./using-third-party-libraries/typed-sha.component");
19 | var untyped_sha_component_1 = require("./using-third-party-libraries/untyped-sha.component");
20 | var using_jquery_addons_component_1 = require("./using-jquery-addons/using-jquery-addons.component");
21 | var appRoutes = [
22 | { path: "", component: welcome_component_1.WelcomeComponent },
23 | { path: "welcome", component: welcome_component_1.WelcomeComponent },
24 | { path: "products", component: product_list_component_1.ProductListComponent },
25 | { path: "product/:id", component: product_detail_component_1.ProductDetailComponent },
26 | { path: "addproduct", component: product_form_component_1.ProductFormComponent },
27 | { path: "adduser", component: signup_form_component_1.SignupFormComponent },
28 | { path: "typedsha", component: typed_sha_component_1.TypedShaComponent },
29 | { path: "untypedsha", component: untyped_sha_component_1.UnTypedShaComponent },
30 | { path: "usingjquery", component: using_jquery_addons_component_1.UsingJQueryAddonsComponent }
31 | ];
32 | exports.routingComponents = [
33 | product_list_component_1.ProductListComponent,
34 | welcome_component_1.WelcomeComponent,
35 | product_detail_component_1.ProductDetailComponent,
36 | product_form_component_1.ProductFormComponent,
37 | signup_form_component_1.SignupFormComponent,
38 | typed_sha_component_1.TypedShaComponent,
39 | untyped_sha_component_1.UnTypedShaComponent,
40 | using_jquery_addons_component_1.UsingJQueryAddonsComponent
41 | ];
42 | var AppRoutingModule = (function () {
43 | function AppRoutingModule() {
44 | }
45 | return AppRoutingModule;
46 | }());
47 | AppRoutingModule = __decorate([
48 | core_1.NgModule({
49 | imports: [router_1.RouterModule.forRoot(appRoutes)],
50 | exports: [router_1.RouterModule]
51 | })
52 | ], AppRoutingModule);
53 | exports.AppRoutingModule = AppRoutingModule;
54 | //# sourceMappingURL=app.routing.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/app.routing.ts:
--------------------------------------------------------------------------------
1 | // - Routes instead of RouteConfig
2 | // - RouterModule instead of provideRoutes
3 | import { Routes, RouterModule } from '@angular/router';
4 | import { NgModule } from '@angular/core';
5 |
6 | import { ProductListComponent } from "./products/product-list.component";
7 | import { WelcomeComponent } from "./home/welcome.component";
8 | import { ProductDetailComponent } from "./products/product-detail.component";
9 | import { ProductFormComponent } from "./products/product-form.component";
10 | import { SignupFormComponent } from "./users/signup-form.component";
11 | import { TypedShaComponent } from "./using-third-party-libraries/typed-sha.component";
12 | import { UnTypedShaComponent } from "./using-third-party-libraries/untyped-sha.component";
13 | import { UsingJQueryAddonsComponent } from "./using-jquery-addons/using-jquery-addons.component";
14 |
15 | const appRoutes: Routes = [
16 | { path: "", component: WelcomeComponent }, // default route
17 | { path: "welcome", component: WelcomeComponent },
18 | { path: "products", component: ProductListComponent },
19 | { path: "product/:id", component: ProductDetailComponent },
20 | { path: "addproduct", component: ProductFormComponent },
21 | { path: "adduser", component: SignupFormComponent },
22 | { path: "typedsha", component: TypedShaComponent },
23 | { path: "untypedsha", component: UnTypedShaComponent },
24 | { path: "usingjquery", component: UsingJQueryAddonsComponent }
25 | ];
26 |
27 | export const routingComponents = [
28 | ProductListComponent,
29 | WelcomeComponent,
30 | ProductDetailComponent,
31 | ProductFormComponent,
32 | SignupFormComponent,
33 | TypedShaComponent,
34 | UnTypedShaComponent,
35 | UsingJQueryAddonsComponent
36 | ];
37 |
38 | @NgModule({
39 | imports: [RouterModule.forRoot(appRoutes)],
40 | exports: [RouterModule]
41 | })
42 | export class AppRoutingModule { }
--------------------------------------------------------------------------------
/MVC5Angular2/App/assets/images/garden_cart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VahidN/MVC5Angular2/81789f3c9010978ca6c6a799d57db9fe3e78990b/MVC5Angular2/App/assets/images/garden_cart.png
--------------------------------------------------------------------------------
/MVC5Angular2/App/assets/images/rejon_Hammer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VahidN/MVC5Angular2/81789f3c9010978ca6c6a799d57db9fe3e78990b/MVC5Angular2/App/assets/images/rejon_Hammer.png
--------------------------------------------------------------------------------
/MVC5Angular2/App/home/welcome.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{pageTitle}}
4 |
5 |
6 |
Home page
7 |
8 |
--------------------------------------------------------------------------------
/MVC5Angular2/App/home/welcome.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | Object.defineProperty(exports, "__esModule", { value: true });
9 | var core_1 = require("@angular/core");
10 | var WelcomeComponent = (function () {
11 | function WelcomeComponent() {
12 | this.pageTitle = "Welcome";
13 | }
14 | return WelcomeComponent;
15 | }());
16 | WelcomeComponent = __decorate([
17 | core_1.Component({
18 | templateUrl: 'app/home/welcome.component.html'
19 | //template: require('./welcome.component.html')//for webpack
20 | })
21 | ], WelcomeComponent);
22 | exports.WelcomeComponent = WelcomeComponent;
23 | //# sourceMappingURL=welcome.component.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/home/welcome.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"welcome.component.js","sourceRoot":"","sources":["welcome.component.ts"],"names":[],"mappings":";;;;;;;;AAAA,sCAA0C;AAM1C,IAAa,gBAAgB;IAJ7B;QAKW,cAAS,GAAW,SAAS,CAAC;IACzC,CAAC;IAAD,uBAAC;AAAD,CAAC,AAFD,IAEC;AAFY,gBAAgB;IAJ5B,gBAAS,CAAC;QACP,WAAW,EAAE,iCAAiC;QAC9C,4DAA4D;KAC/D,CAAC;GACW,gBAAgB,CAE5B;AAFY,4CAAgB"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/home/welcome.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | templateUrl: 'app/home/welcome.component.html'
5 | //template: require('./welcome.component.html')//for webpack
6 | })
7 | export class WelcomeComponent {
8 | public pageTitle: string = "Welcome";
9 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Angular With Webpack
6 |
7 |
8 |
9 |
10 | Loading...
11 |
12 |
--------------------------------------------------------------------------------
/MVC5Angular2/App/main.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,+DAA+D;AAC/D,gEAAgE;AAChE,iEAAiE;;;AAEjE,8EAA2E;AAC3E,2CAAyC;AAEzC,iDAAsB,EAAE,CAAC,eAAe,CAAC,sBAAS,CAAC,CAAC"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/main.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | ///
4 | ///
5 |
6 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
7 | import { AppModule } from './app.module';
8 |
9 | platformBrowserDynamic().bootstrapModule(AppModule);
--------------------------------------------------------------------------------
/MVC5Angular2/App/polyfills.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"polyfills.js","sourceRoot":"","sources":["polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG,CAAC,aAAa"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/polyfills.ts:
--------------------------------------------------------------------------------
1 | /*import 'core-js/es6';
2 | import 'reflect-metadata';
3 | require('zone.js/dist/zone');
4 |
5 | if (process.env.ENV === 'production') {
6 | // Production
7 | } else {
8 | // Development
9 | Error['stackTraceLimit'] = Infinity;
10 | require('zone.js/dist/long-stack-trace-zone');
11 | }*/ //for webpack
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-detail.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{pageTitle}}
4 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-detail.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | Object.defineProperty(exports, "__esModule", { value: true });
12 | var core_1 = require("@angular/core");
13 | var router_1 = require("@angular/router");
14 | var ProductDetailComponent = (function () {
15 | function ProductDetailComponent(_route, _router) {
16 | this._route = _route;
17 | this._router = _router;
18 | this.pageTitle = 'Product Detail';
19 | }
20 | ProductDetailComponent.prototype.ngOnInit = function () {
21 | var _this = this;
22 | this.sub = this._route.params
23 | .subscribe(function (params) {
24 | var id = +params['id']; // (+) converts string 'id' to a number
25 | _this.pageTitle += ": " + id;
26 | });
27 | };
28 | ProductDetailComponent.prototype.ngOnDestroy = function () {
29 | this.sub.unsubscribe(); // we must unsubscribe before Angular destroys the component. Failure to do so could create a memory leak.
30 | };
31 | ProductDetailComponent.prototype.onBack = function () {
32 | this._router.navigate(['/products']);
33 | };
34 | return ProductDetailComponent;
35 | }());
36 | ProductDetailComponent = __decorate([
37 | core_1.Component({
38 | templateUrl: 'app/products/product-detail.component.html'
39 | //template: require('./product-detail.component.html')//for webpack
40 | }),
41 | __metadata("design:paramtypes", [router_1.ActivatedRoute, router_1.Router])
42 | ], ProductDetailComponent);
43 | exports.ProductDetailComponent = ProductDetailComponent;
44 | //# sourceMappingURL=product-detail.component.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-detail.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"product-detail.component.js","sourceRoot":"","sources":["product-detail.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA6D;AAC7D,0CAAyD;AAMzD,IAAa,sBAAsB;IAM/B,gCAAoB,MAAsB,EAAU,OAAe;QAA/C,WAAM,GAAN,MAAM,CAAgB;QAAU,YAAO,GAAP,OAAO,CAAQ;QAFnE,cAAS,GAAW,gBAAgB,CAAC;IAGrC,CAAC;IAED,yCAAQ,GAAR;QAAA,iBAMC;QALG,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM;aACxB,SAAS,CAAC,UAAA,MAAM;YACb,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,uCAAuC;YAC/D,KAAI,CAAC,SAAS,IAAI,OAAK,EAAI,CAAC;QAChC,CAAC,CAAC,CAAC;IACX,CAAC;IAED,4CAAW,GAAX;QACI,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,0GAA0G;IACtI,CAAC;IAED,uCAAM,GAAN;QACI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IACzC,CAAC;IACL,6BAAC;AAAD,CAAC,AAxBD,IAwBC;AAxBY,sBAAsB;IAJlC,gBAAS,CAAC;QACP,WAAW,EAAE,4CAA4C;QACzD,mEAAmE;KACtE,CAAC;qCAO8B,uBAAc,EAAmB,eAAM;GAN1D,sBAAsB,CAwBlC;AAxBY,wDAAsB"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-detail.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, OnDestroy } from '@angular/core';
2 | import { Router, ActivatedRoute } from '@angular/router';
3 |
4 | @Component({
5 | templateUrl: 'app/products/product-detail.component.html'
6 | //template: require('./product-detail.component.html')//for webpack
7 | })
8 | export class ProductDetailComponent implements OnInit, OnDestroy {
9 |
10 | private sub: any;
11 |
12 | pageTitle: string = 'Product Detail';
13 |
14 | constructor(private _route: ActivatedRoute, private _router: Router) {
15 | }
16 |
17 | ngOnInit(): void {
18 | this.sub = this._route.params
19 | .subscribe(params => {
20 | let id = +params['id']; // (+) converts string 'id' to a number
21 | this.pageTitle += `: ${id}`;
22 | });
23 | }
24 |
25 | ngOnDestroy(): void {
26 | this.sub.unsubscribe(); // we must unsubscribe before Angular destroys the component. Failure to do so could create a memory leak.
27 | }
28 |
29 | onBack(): void {
30 | this._router.navigate(['/products']);
31 | }
32 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-filter.pipe.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | Object.defineProperty(exports, "__esModule", { value: true });
9 | var core_1 = require("@angular/core");
10 | var ProductFilterPipe = (function () {
11 | function ProductFilterPipe() {
12 | }
13 | ProductFilterPipe.prototype.transform = function (value, args) {
14 | var filter = args[0] ? args[0].toLocaleLowerCase() : null;
15 | return filter ? value.filter(function (product) {
16 | return product.productName.toLocaleLowerCase().indexOf(filter) != -1;
17 | }) : value;
18 | };
19 | return ProductFilterPipe;
20 | }());
21 | ProductFilterPipe = __decorate([
22 | core_1.Pipe({
23 | name: 'productFilter'
24 | })
25 | ], ProductFilterPipe);
26 | exports.ProductFilterPipe = ProductFilterPipe;
27 | //# sourceMappingURL=product-filter.pipe.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-filter.pipe.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"product-filter.pipe.js","sourceRoot":"","sources":["product-filter.pipe.ts"],"names":[],"mappings":";;;;;;;;AAAA,sCAAoD;AAMpD,IAAa,iBAAiB;IAA9B;IAOA,CAAC;IALG,qCAAS,GAAT,UAAU,KAAiB,EAAE,IAAc;QACvC,IAAI,MAAM,GAAW,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC;QAClE,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,UAAC,OAAiB;YAC3C,OAAA,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAA7D,CAA6D,CAAC,GAAG,KAAK,CAAC;IAC/E,CAAC;IACL,wBAAC;AAAD,CAAC,AAPD,IAOC;AAPY,iBAAiB;IAH7B,WAAI,CAAC;QACF,IAAI,EAAE,eAAe;KACxB,CAAC;GACW,iBAAiB,CAO7B;AAPY,8CAAiB"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-filter.pipe.ts:
--------------------------------------------------------------------------------
1 | import { PipeTransform, Pipe } from '@angular/core';
2 | import { IProduct } from './product';
3 |
4 | @Pipe({
5 | name: 'productFilter'
6 | })
7 | export class ProductFilterPipe implements PipeTransform {
8 |
9 | transform(value: IProduct[], args: string[]): IProduct[] {
10 | let filter: string = args[0] ? args[0].toLocaleLowerCase() : null;
11 | return filter ? value.filter((product: IProduct) =>
12 | product.productName.toLocaleLowerCase().indexOf(filter) != -1) : value;
13 | }
14 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-form.component.html:
--------------------------------------------------------------------------------
1 |
103 |
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-form.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | Object.defineProperty(exports, "__esModule", { value: true });
12 | var core_1 = require("@angular/core");
13 | var router_1 = require("@angular/router");
14 | var product_service_1 = require("./product.service");
15 | var ProductFormComponent = (function () {
16 | function ProductFormComponent(_productService, _router) {
17 | this._productService = _productService;
18 | this._router = _router;
19 | this.productModel = {}; // creates an empty object of an interface
20 | }
21 | ProductFormComponent.prototype.log = function (productName) {
22 | console.log(productName);
23 | };
24 | ProductFormComponent.prototype.onSubmit = function (form) {
25 | var _this = this;
26 | console.log(form);
27 | console.log(this.productModel);
28 | this._productService.addProduct(this.productModel)
29 | .subscribe(function (product) {
30 | console.log("ID: " + product.productId);
31 | _this._router.navigate(["/products"]);
32 | });
33 | };
34 | return ProductFormComponent;
35 | }());
36 | ProductFormComponent = __decorate([
37 | core_1.Component({
38 | //selector: 'product-form',
39 | templateUrl: "app/products/product-form.component.html"
40 | //template: require('./product-form.component.html')//for webpack
41 | }),
42 | __metadata("design:paramtypes", [product_service_1.ProductService, router_1.Router])
43 | ], ProductFormComponent);
44 | exports.ProductFormComponent = ProductFormComponent;
45 | //# sourceMappingURL=product-form.component.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-form.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"product-form.component.js","sourceRoot":"","sources":["product-form.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA0C;AAC1C,0CAAyC;AAGzC,qDAAmD;AAOnD,IAAa,oBAAoB;IAI7B,8BAAoB,eAA+B,EAAU,OAAe;QAAxD,oBAAe,GAAf,eAAe,CAAgB;QAAU,YAAO,GAAP,OAAO,CAAQ;QAF5E,iBAAY,GAAa,EAAE,CAAC,CAAC,0CAA0C;IAES,CAAC;IAEjF,kCAAG,GAAH,UAAI,WAAW;QACX,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;IAED,uCAAQ,GAAR,UAAS,IAAI;QAAb,iBASC;QARG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAE/B,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC;aAC7C,SAAS,CAAC,UAAC,OAAiB;YACzB,OAAO,CAAC,GAAG,CAAC,SAAO,OAAO,CAAC,SAAW,CAAC,CAAC;YACxC,KAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACX,CAAC;IACL,2BAAC;AAAD,CAAC,AApBD,IAoBC;AApBY,oBAAoB;IALhC,gBAAS,CAAC;QACP,2BAA2B;QAC3B,WAAW,EAAE,0CAA0C;QACvD,iEAAiE;KACpE,CAAC;qCAKuC,gCAAc,EAAmB,eAAM;GAJnE,oBAAoB,CAoBhC;AApBY,oDAAoB"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-form.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from "@angular/core";
2 | import { Router } from "@angular/router";
3 |
4 | import { IProduct } from "./product";
5 | import { ProductService } from "./product.service";
6 |
7 | @Component({
8 | //selector: 'product-form',
9 | templateUrl: "app/products/product-form.component.html"
10 | //template: require('./product-form.component.html')//for webpack
11 | })
12 | export class ProductFormComponent {
13 |
14 | productModel = {}; // creates an empty object of an interface
15 |
16 | constructor(private _productService: ProductService, private _router: Router) { }
17 |
18 | log(productName): void {
19 | console.log(productName);
20 | }
21 |
22 | onSubmit(form): void {
23 | console.log(form);
24 | console.log(this.productModel);
25 |
26 | this._productService.addProduct(this.productModel)
27 | .subscribe((product: IProduct) => {
28 | console.log(`ID: ${product.productId}`);
29 | this._router.navigate(["/products"]);
30 | });
31 | }
32 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-list.component.css:
--------------------------------------------------------------------------------
1 | thead {
2 | color: #337AB7;
3 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-list.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{pageTitle}}
4 |
5 |
6 |
7 |
Filter by:
8 |
9 |
11 |
12 |
13 |
14 |
15 |
Filtered by: {{listFilter}}
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
25 | {{showImage ? 'Hide' : 'Show'}} Image
26 |
27 |
28 | Product
29 | Code
30 | Available
31 | Price
32 | 5 Star Rating
33 |
34 |
35 |
36 |
37 |
38 |
43 |
44 |
45 |
46 | {{product.productName}}
47 |
48 |
49 | {{ product.productCode | lowercase }}
50 | {{ product.releaseDate }}
51 | {{ product.price | currency:'USD':true:'1.2-2'}}
52 |
53 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-list.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | Object.defineProperty(exports, "__esModule", { value: true });
12 | var core_1 = require("@angular/core");
13 | var product_service_1 = require("./product.service");
14 | var ProductListComponent = (function () {
15 | function ProductListComponent(_productService) {
16 | this._productService = _productService;
17 | this.pageTitle = 'Product List';
18 | this.imageWidth = 50;
19 | this.imageMargin = 2;
20 | this.showImage = false;
21 | this.listFilter = '';
22 | }
23 | ProductListComponent.prototype.toggleImage = function () {
24 | this.showImage = !this.showImage;
25 | };
26 | ProductListComponent.prototype.ngOnInit = function () {
27 | var _this = this;
28 | //console.log('In OnInit');
29 | this._productService.getProducts()
30 | .subscribe(function (products) { return _this.products = products; }, function (error) { return _this.errorMessage = error; });
31 | };
32 | ProductListComponent.prototype.onRatingClicked = function (message) {
33 | this.pageTitle = 'Product List: ' + message;
34 | };
35 | return ProductListComponent;
36 | }());
37 | ProductListComponent = __decorate([
38 | core_1.Component({
39 | selector: 'pm-products',
40 | templateUrl: 'app/products/product-list.component.html',
41 | //template: require('./product-list.component.html'),//for webpack
42 | styleUrls: ['app/products/product-list.component.css']
43 | //styles: [require('./product-list.component.css')],//for webpack
44 | }),
45 | __metadata("design:paramtypes", [product_service_1.ProductService])
46 | ], ProductListComponent);
47 | exports.ProductListComponent = ProductListComponent;
48 | //# sourceMappingURL=product-list.component.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-list.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"product-list.component.js","sourceRoot":"","sources":["product-list.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAkD;AAElD,qDAAmD;AASnD,IAAa,oBAAoB;IAU7B,8BAAoB,eAA+B;QAA/B,oBAAe,GAAf,eAAe,CAAgB;QATnD,cAAS,GAAW,cAAc,CAAC;QACnC,eAAU,GAAW,EAAE,CAAC;QACxB,gBAAW,GAAW,CAAC,CAAC;QACxB,cAAS,GAAY,KAAK,CAAC;QAC3B,eAAU,GAAW,EAAE,CAAC;IAMxB,CAAC;IAED,0CAAW,GAAX;QACI,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;IACrC,CAAC;IAED,uCAAQ,GAAR;QAAA,iBAMC;QALG,2BAA2B;QAC3B,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE;aACb,SAAS,CACJ,UAAA,QAAQ,IAAI,OAAA,KAAI,CAAC,QAAQ,GAAG,QAAQ,EAAxB,CAAwB,EACpC,UAAA,KAAK,IAAI,OAAA,KAAI,CAAC,YAAY,GAAQ,KAAK,EAA9B,CAA8B,CAAC,CAAC;IACvE,CAAC;IAED,8CAAe,GAAf,UAAgB,OAAe;QAC3B,IAAI,CAAC,SAAS,GAAG,gBAAgB,GAAG,OAAO,CAAC;IAChD,CAAC;IACL,2BAAC;AAAD,CAAC,AA5BD,IA4BC;AA5BY,oBAAoB;IAPhC,gBAAS,CAAC;QACP,QAAQ,EAAE,aAAa;QACvB,WAAW,EAAE,0CAA0C;QACvD,kEAAkE;QAClE,SAAS,EAAE,CAAC,yCAAyC,CAAC;QACtD,iEAAiE;KACpE,CAAC;qCAWuC,gCAAc;GAV1C,oBAAoB,CA4BhC;AA5BY,oDAAoB"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product-list.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { IProduct } from './product';
3 | import { ProductService } from './product.service';
4 |
5 | @Component({
6 | selector: 'pm-products',
7 | templateUrl: 'app/products/product-list.component.html',
8 | //template: require('./product-list.component.html'),//for webpack
9 | styleUrls: ['app/products/product-list.component.css']
10 | //styles: [require('./product-list.component.css')],//for webpack
11 | })
12 | export class ProductListComponent implements OnInit {
13 | pageTitle: string = 'Product List';
14 | imageWidth: number = 50;
15 | imageMargin: number = 2;
16 | showImage: boolean = false;
17 | listFilter: string = '';
18 | errorMessage: string;
19 |
20 | products: IProduct[];
21 |
22 | constructor(private _productService: ProductService) {
23 | }
24 |
25 | toggleImage(): void {
26 | this.showImage = !this.showImage;
27 | }
28 |
29 | ngOnInit(): void {
30 | //console.log('In OnInit');
31 | this._productService.getProducts()
32 | .subscribe(
33 | products => this.products = products,
34 | error => this.errorMessage = error);
35 | }
36 |
37 | onRatingClicked(message: string): void {
38 | this.pageTitle = 'Product List: ' + message;
39 | }
40 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | //# sourceMappingURL=product.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"product.js","sourceRoot":"","sources":["product.ts"],"names":[],"mappings":""}
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product.service.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | Object.defineProperty(exports, "__esModule", { value: true });
12 | var core_1 = require("@angular/core");
13 | var http_1 = require("@angular/http");
14 | var Observable_1 = require("rxjs/Observable");
15 | var http_2 = require("@angular/http");
16 | var ProductService = (function () {
17 | function ProductService(_http) {
18 | this._http = _http;
19 | this._productUrl = '/home/products';
20 | this._addProductUrl = '/home/AddProduct';
21 | }
22 | ProductService.prototype.getProducts = function () {
23 | return this._http.get(this._productUrl)
24 | .map(function (response) { return response.json(); })
25 | .do(function (data) { return console.log("All: " + JSON.stringify(data)); })
26 | .catch(this.handleError);
27 | };
28 | ProductService.prototype.handleError = function (error) {
29 | console.error(error);
30 | return Observable_1.Observable.throw(error.json().error || 'Server error');
31 | };
32 | ProductService.prototype.addProduct = function (product) {
33 | var headers = new http_2.Headers({ 'Content-Type': 'application/json' }); // for ASP.NET MVC
34 | var options = new http_2.RequestOptions({ headers: headers });
35 | return this._http.post(this._addProductUrl, JSON.stringify(product), options)
36 | .map(function (response) { return response.json(); })
37 | .do(function (data) { return console.log("Product: " + JSON.stringify(data)); })
38 | .catch(this.handleError);
39 | };
40 | return ProductService;
41 | }());
42 | ProductService = __decorate([
43 | core_1.Injectable(),
44 | __metadata("design:paramtypes", [http_1.Http])
45 | ], ProductService);
46 | exports.ProductService = ProductService;
47 | //# sourceMappingURL=product.service.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product.service.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"product.service.js","sourceRoot":"","sources":["product.service.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA2C;AAE3C,sCAA+C;AAC/C,8CAA6C;AAC7C,sCAAwD;AAGxD,IAAa,cAAc;IAIvB,wBAAoB,KAAW;QAAX,UAAK,GAAL,KAAK,CAAM;QAHvB,gBAAW,GAAG,gBAAgB,CAAC;QAC/B,mBAAc,GAAG,kBAAkB,CAAC;IAET,CAAC;IAEpC,oCAAW,GAAX;QACI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC;aAClC,GAAG,CAAC,UAAC,QAAkB,IAAK,OAAY,QAAQ,CAAC,IAAI,EAAE,EAA3B,CAA2B,CAAC;aACxD,EAAE,CAAC,UAAA,IAAI,IAAI,OAAA,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAA3C,CAA2C,CAAC;aACvD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAEO,oCAAW,GAAnB,UAAoB,KAAe;QAC/B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,CAAC,uBAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,cAAc,CAAC,CAAC;IAClE,CAAC;IAED,mCAAU,GAAV,UAAW,OAAiB;QACxB,IAAI,OAAO,GAAG,IAAI,cAAO,CAAC,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,kBAAkB;QACrF,IAAI,OAAO,GAAG,IAAI,qBAAc,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAEvD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;aACxE,GAAG,CAAC,UAAC,QAAkB,IAAK,OAAU,QAAQ,CAAC,IAAI,EAAE,EAAzB,CAAyB,CAAC;aACtD,EAAE,CAAC,UAAA,IAAI,IAAI,OAAA,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAA/C,CAA+C,CAAC;aAC3D,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IACL,qBAAC;AAAD,CAAC,AA3BD,IA2BC;AA3BY,cAAc;IAD1B,iBAAU,EAAE;qCAKkB,WAAI;GAJtB,cAAc,CA2B1B;AA3BY,wCAAc"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { IProduct } from './product';
3 | import { Http, Response } from '@angular/http';
4 | import { Observable } from 'rxjs/Observable';
5 | import { Headers, RequestOptions } from '@angular/http';
6 |
7 | @Injectable()
8 | export class ProductService {
9 | private _productUrl = '/home/products';
10 | private _addProductUrl = '/home/AddProduct';
11 |
12 | constructor(private _http: Http) { }
13 |
14 | getProducts(): Observable {
15 | return this._http.get(this._productUrl)
16 | .map((response: Response) => response.json())
17 | .do(data => console.log("All: " + JSON.stringify(data)))
18 | .catch(this.handleError);
19 | }
20 |
21 | private handleError(error: Response) {
22 | console.error(error);
23 | return Observable.throw(error.json().error || 'Server error');
24 | }
25 |
26 | addProduct(product: IProduct): Observable {
27 | let headers = new Headers({ 'Content-Type': 'application/json' }); // for ASP.NET MVC
28 | let options = new RequestOptions({ headers: headers });
29 |
30 | return this._http.post(this._addProductUrl, JSON.stringify(product), options)
31 | .map((response: Response) => response.json())
32 | .do(data => console.log("Product: " + JSON.stringify(data)))
33 | .catch(this.handleError);
34 | }
35 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/products/product.ts:
--------------------------------------------------------------------------------
1 | export interface IProduct {
2 | productId: number;
3 | productName: string;
4 | productCode: string;
5 | releaseDate: string;
6 | price: number;
7 | description: string;
8 | starRating: number;
9 | imageUrl: string;
10 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/shared/star.component.css:
--------------------------------------------------------------------------------
1 | .crop {
2 | overflow: hidden;
3 | }
4 |
5 | div {
6 | cursor: pointer;
7 | }
8 |
--------------------------------------------------------------------------------
/MVC5Angular2/App/shared/star.component.html:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/MVC5Angular2/App/shared/star.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | Object.defineProperty(exports, "__esModule", { value: true });
12 | var core_1 = require("@angular/core");
13 | var StarComponent = (function () {
14 | function StarComponent() {
15 | this.ratingClicked = new core_1.EventEmitter();
16 | }
17 | StarComponent.prototype.ngOnChanges = function () {
18 | this.starWidth = this.rating * 86 / 5;
19 | };
20 | StarComponent.prototype.onClick = function () {
21 | this.ratingClicked.emit("The rating " + this.rating + " was clicked!");
22 | };
23 | return StarComponent;
24 | }());
25 | __decorate([
26 | core_1.Input(),
27 | __metadata("design:type", Number)
28 | ], StarComponent.prototype, "rating", void 0);
29 | __decorate([
30 | core_1.Output(),
31 | __metadata("design:type", core_1.EventEmitter)
32 | ], StarComponent.prototype, "ratingClicked", void 0);
33 | StarComponent = __decorate([
34 | core_1.Component({
35 | selector: 'ai-star',
36 | templateUrl: 'app/shared/star.component.html',
37 | //template: require('./star.component.html'),//for webpack
38 | styleUrls: ['app/shared/star.component.css']
39 | //styles: [require('./star.component.css')]//for webpack
40 | })
41 | ], StarComponent);
42 | exports.StarComponent = StarComponent;
43 | //# sourceMappingURL=star.component.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/shared/star.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"star.component.js","sourceRoot":"","sources":["star.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAkF;AASlF,IAAa,aAAa;IAP1B;QAUc,kBAAa,GAAyB,IAAI,mBAAY,EAAU,CAAC;IAS/E,CAAC;IAPG,mCAAW,GAAX;QACI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,CAAC,CAAC;IAC1C,CAAC;IAED,+BAAO,GAAP;QACI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAc,IAAI,CAAC,MAAM,kBAAe,CAAC,CAAC;IACtE,CAAC;IACL,oBAAC;AAAD,CAAC,AAZD,IAYC;AAXY;IAAR,YAAK,EAAE;;6CAAgB;AAEd;IAAT,aAAM,EAAE;8BAAgB,mBAAY;oDAAsC;AAHlE,aAAa;IAPzB,gBAAS,CAAC;QACP,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,gCAAgC;QAC7C,0DAA0D;QAC1D,SAAS,EAAE,CAAC,+BAA+B,CAAC;QAC5C,wDAAwD;KAC3D,CAAC;GACW,aAAa,CAYzB;AAZY,sCAAa"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/shared/star.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnChanges, Input, Output, EventEmitter } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'ai-star',
5 | templateUrl: 'app/shared/star.component.html',
6 | //template: require('./star.component.html'),//for webpack
7 | styleUrls: ['app/shared/star.component.css']
8 | //styles: [require('./star.component.css')]//for webpack
9 | })
10 | export class StarComponent implements OnChanges {
11 | @Input() rating: number;
12 | starWidth: number;
13 | @Output() ratingClicked: EventEmitter = new EventEmitter();
14 |
15 | ngOnChanges(): void {
16 | this.starWidth = this.rating * 86 / 5;
17 | }
18 |
19 | onClick() {
20 | this.ratingClicked.emit(`The rating ${this.rating} was clicked!`);
21 | }
22 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/Result.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"result.js","sourceRoot":"","sources":["result.ts"],"names":[],"mappings":""}
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/emailValidators.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | var EmailValidators = (function () {
4 | function EmailValidators() {
5 | }
6 | EmailValidators.email = function (control) {
7 | var regEx = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
8 | var valid = regEx.test(control.value);
9 | return valid ? null : { email: true };
10 | };
11 | return EmailValidators;
12 | }());
13 | exports.EmailValidators = EmailValidators;
14 | //# sourceMappingURL=emailValidators.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/emailValidators.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"emailValidators.js","sourceRoot":"","sources":["emailValidators.ts"],"names":[],"mappings":";;AAEA;IAAA;IAMA,CAAC;IALU,qBAAK,GAAZ,UAAa,OAAoB;QAC7B,IAAI,KAAK,GAAG,wJAAwJ,CAAC;QACrK,IAAI,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC1C,CAAC;IACL,sBAAC;AAAD,CAAC,AAND,IAMC;AANY,0CAAe"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/emailValidators.ts:
--------------------------------------------------------------------------------
1 | import { FormControl } from '@angular/forms';
2 |
3 | export class EmailValidators {
4 | static email(control: FormControl) {
5 | var regEx = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
6 | var valid = regEx.test(control.value);
7 | return valid ? null : { email: true };
8 | }
9 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/result.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | //# sourceMappingURL=result.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/result.ts:
--------------------------------------------------------------------------------
1 | export interface IResult {
2 | result: boolean;
3 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/signup-form.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Add User
6 |
7 |
8 |
59 |
65 |
66 |
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/signup-form.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | Object.defineProperty(exports, "__esModule", { value: true });
12 | var core_1 = require("@angular/core");
13 | var forms_1 = require("@angular/forms");
14 | var usernameValidators_1 = require("./usernameValidators");
15 | var emailValidators_1 = require("./emailValidators");
16 | var user_service_1 = require("./user.service");
17 | var Rx_1 = require("rxjs/Rx");
18 | var SignupFormComponent = (function () {
19 | function SignupFormComponent(_userService) {
20 | var _this = this;
21 | this._userService = _userService;
22 | this.nameCtrl = new forms_1.FormControl('', [forms_1.Validators.required, usernameValidators_1.UsernameValidators.cannotContainSpace], [function (control) { return _this.nameShouldBeUnique(control); }]);
23 | this.emailCtrl = new forms_1.FormControl('', [forms_1.Validators.required, emailValidators_1.EmailValidators.email]);
24 | this.passwordCtrl = new forms_1.FormControl('', [forms_1.Validators.required]);
25 | this.form = new forms_1.FormGroup({
26 | name: this.nameCtrl,
27 | email: this.emailCtrl,
28 | password: this.passwordCtrl
29 | });
30 | }
31 | SignupFormComponent.prototype.onSubmit = function () {
32 | console.log(this.form);
33 | console.log(this.form.value);
34 | /*this.form.find('name').setErrors({
35 | invalidData : true
36 | });*/
37 | this._userService.addUser(this.form.value)
38 | .subscribe(function (user) {
39 | console.log("ID: " + user.id);
40 | });
41 | };
42 | SignupFormComponent.prototype.nameShouldBeUnique = function (control) {
43 | var _this = this;
44 | return new Rx_1.Observable(function (obs) {
45 | control
46 | .valueChanges
47 | .debounceTime(400)
48 | .distinctUntilChanged()
49 | .flatMap(function (term) { return _this._userService.isUserNameUnique({ "name": term }); })
50 | .subscribe(function (result) {
51 | if (result.result) {
52 | obs.next(null);
53 | }
54 | else {
55 | obs.next({ 'nameShouldBeUnique': true });
56 | }
57 | obs.complete();
58 | }, function (error) {
59 | obs.next(null);
60 | obs.complete();
61 | });
62 | });
63 | };
64 | SignupFormComponent.prototype.nameShouldBeUniqueNormal = function (control) {
65 | var _this = this;
66 | var name = control.value;
67 | return new Promise(function (resolve) {
68 | _this._userService.isUserNameUnique({ "name": name }).subscribe(function (result) {
69 | resolve(result.result ? null : { 'nameShouldBeUnique': true });
70 | }, function (error) {
71 | resolve(null);
72 | });
73 | });
74 | };
75 | return SignupFormComponent;
76 | }());
77 | SignupFormComponent = __decorate([
78 | core_1.Component({
79 | selector: 'signup-form',
80 | templateUrl: 'app/users/signup-form.component.html',
81 | //template: require('./signup-form.component.html'),//for webpack
82 | providers: [user_service_1.UserService]
83 | }),
84 | __metadata("design:paramtypes", [user_service_1.UserService])
85 | ], SignupFormComponent);
86 | exports.SignupFormComponent = SignupFormComponent;
87 | //# sourceMappingURL=signup-form.component.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/signup-form.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"signup-form.component.js","sourceRoot":"","sources":["signup-form.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA0C;AAC1C,wCAAoE;AAEpE,2DAA0D;AAC1D,qDAAoD;AACpD,+CAA6C;AAG7C,8BAAmC;AAQnC,IAAa,mBAAmB;IAQ5B,6BAAoB,YAAyB;QAA7C,iBAMC;QANmB,iBAAY,GAAZ,YAAY,CAAa;QAL7C,aAAQ,GAAG,IAAI,mBAAW,CAAC,EAAE,EAAE,CAAC,kBAAU,CAAC,QAAQ,EAAE,uCAAkB,CAAC,kBAAkB,CAAC,EAC5D,CAAC,UAAC,OAAoB,IAAK,OAAA,KAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAhC,CAAgC,CAAC,CAAC,CAAC;QAC7F,cAAS,GAAG,IAAI,mBAAW,CAAC,EAAE,EAAE,CAAC,kBAAU,CAAC,QAAQ,EAAE,iCAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9E,iBAAY,GAAG,IAAI,mBAAW,CAAC,EAAE,EAAE,CAAC,kBAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;QAGtD,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAS,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,QAAQ;YACnB,KAAK,EAAE,IAAI,CAAC,SAAS;YACrB,QAAQ,EAAE,IAAI,CAAC,YAAY;SAC9B,CAAC,CAAC;IACP,CAAC;IAED,sCAAQ,GAAR;QACI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE7B;;aAEK;QAEL,IAAI,CAAC,YAAY,CAAC,OAAO,CAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;aAC5C,SAAS,CAAC,UAAC,IAAW;YACnB,OAAO,CAAC,GAAG,CAAC,SAAO,IAAI,CAAC,EAAI,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACX,CAAC;IAED,gDAAkB,GAAlB,UAAmB,OAAoB;QAAvC,iBAsBC;QArBG,MAAM,CAAC,IAAI,eAAU,CAAC,UAAC,GAAQ;YAC3B,OAAO;iBACF,YAAY;iBACZ,YAAY,CAAC,GAAG,CAAC;iBACjB,oBAAoB,EAAE;iBACtB,OAAO,CAAC,UAAA,IAAI,IAAI,OAAA,KAAI,CAAC,YAAY,CAAC,gBAAgB,CAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAA3D,CAA2D,CAAC;iBAC5E,SAAS,CAAC,UAAC,MAAe;gBACvB,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACnB,CAAC;gBACD,IAAI,CAAC,CAAC;oBACF,GAAG,CAAC,IAAI,CAAC,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC7C,CAAC;gBAED,GAAG,CAAC,QAAQ,EAAE,CAAC;YACnB,CAAC,EACD,UAAA,KAAK;gBACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACf,GAAG,CAAC,QAAQ,EAAE,CAAC;YACnB,CAAC,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACP,CAAC;IAED,sDAAwB,GAAxB,UAAyB,OAAoB;QAA7C,iBAcC;QAbG,IAAI,IAAI,GAAW,OAAO,CAAC,KAAK,CAAC;QACjC,MAAM,CAAC,IAAI,OAAO,CAAC,UAAC,OAAO;YACvB,KAAI,CAAC,YAAY,CAAC,gBAAgB,CAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CACjE,UAAC,MAAe;gBACZ,OAAO,CACH,MAAM,CAAC,MAAM,GAAG,IAAI,GAAG,EAAE,oBAAoB,EAAE,IAAI,EAAE,CACxD,CAAC;YACN,CAAC,EACD,UAAA,KAAK;gBACD,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC,CACJ,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IACL,0BAAC;AAAD,CAAC,AArED,IAqEC;AArEY,mBAAmB;IAN/B,gBAAS,CAAC;QACP,QAAQ,EAAE,aAAa;QACvB,WAAW,EAAE,sCAAsC;QACnD,iEAAiE;QACjE,SAAS,EAAE,CAAC,0BAAW,CAAC;KAC3B,CAAC;qCASoC,0BAAW;GARpC,mBAAmB,CAqE/B;AArEY,kDAAmB"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/signup-form.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 | import { Validators, FormControl, FormGroup } from '@angular/forms';
3 |
4 | import { UsernameValidators } from './usernameValidators';
5 | import { EmailValidators } from './emailValidators';
6 | import { UserService } from './user.service';
7 | import { IUser } from './user';
8 | import { IResult } from './result';
9 | import {Observable} from 'rxjs/Rx';
10 |
11 | @Component({
12 | selector: 'signup-form',
13 | templateUrl: 'app/users/signup-form.component.html',
14 | //template: require('./signup-form.component.html'),//for webpack
15 | providers: [UserService]
16 | })
17 | export class SignupFormComponent {
18 |
19 | form: FormGroup;
20 | nameCtrl = new FormControl('', [Validators.required, UsernameValidators.cannotContainSpace],
21 | [(control: FormControl) => this.nameShouldBeUnique(control)]);
22 | emailCtrl = new FormControl('', [Validators.required, EmailValidators.email]);
23 | passwordCtrl = new FormControl('', [Validators.required]);
24 |
25 | constructor(private _userService: UserService) {
26 | this.form = new FormGroup({
27 | name: this.nameCtrl,
28 | email: this.emailCtrl,
29 | password: this.passwordCtrl
30 | });
31 | }
32 |
33 | onSubmit(): void {
34 | console.log(this.form);
35 | console.log(this.form.value);
36 |
37 | /*this.form.find('name').setErrors({
38 | invalidData : true
39 | });*/
40 |
41 | this._userService.addUser(this.form.value)
42 | .subscribe((user: IUser) => {
43 | console.log(`ID: ${user.id}`);
44 | });
45 | }
46 |
47 | nameShouldBeUnique(control: FormControl) {
48 | return new Observable((obs: any) => {
49 | control
50 | .valueChanges
51 | .debounceTime(400)
52 | .distinctUntilChanged()
53 | .flatMap(term => this._userService.isUserNameUnique({ "name": term }))
54 | .subscribe((result: IResult) => {
55 | if (result.result) {
56 | obs.next(null);
57 | }
58 | else {
59 | obs.next({ 'nameShouldBeUnique': true });
60 | }
61 |
62 | obs.complete();
63 | },
64 | error => {
65 | obs.next(null);
66 | obs.complete();
67 | });
68 | });
69 | }
70 |
71 | nameShouldBeUniqueNormal(control: FormControl) {
72 | let name: string = control.value;
73 | return new Promise((resolve) => {
74 | this._userService.isUserNameUnique({ "name": name }).subscribe(
75 | (result: IResult) => {
76 | resolve(
77 | result.result ? null : { 'nameShouldBeUnique': true }
78 | );
79 | },
80 | error => {
81 | resolve(null);
82 | }
83 | );
84 | });
85 | }
86 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/user.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | //# sourceMappingURL=user.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/user.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"user.js","sourceRoot":"","sources":["user.ts"],"names":[],"mappings":""}
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/user.service.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | Object.defineProperty(exports, "__esModule", { value: true });
12 | var core_1 = require("@angular/core");
13 | var http_1 = require("@angular/http");
14 | var Observable_1 = require("rxjs/Observable");
15 | var http_2 = require("@angular/http");
16 | var UserService = (function () {
17 | function UserService(_http) {
18 | this._http = _http;
19 | this._checkUserUrl = '/home/checkUser';
20 | this._addUserUrl = '/home/addUser';
21 | }
22 | UserService.prototype.handleError = function (error) {
23 | console.error(error);
24 | return Observable_1.Observable.throw(error.json().error || 'Server error');
25 | };
26 | UserService.prototype.isUserNameUnique = function (user) {
27 | var headers = new http_2.Headers({ 'Content-Type': 'application/json' }); // for ASP.NET MVC
28 | var options = new http_2.RequestOptions({ headers: headers });
29 | return this._http.post(this._checkUserUrl, JSON.stringify(user), options)
30 | .map(function (response) { return response.json(); })
31 | .do(function (data) { return console.log("User: " + JSON.stringify(data)); })
32 | .catch(this.handleError);
33 | };
34 | UserService.prototype.addUser = function (user) {
35 | var headers = new http_2.Headers({ 'Content-Type': 'application/json' }); // for ASP.NET MVC
36 | var options = new http_2.RequestOptions({ headers: headers });
37 | return this._http.post(this._addUserUrl, JSON.stringify(user), options)
38 | .map(function (response) { return response.json(); })
39 | .do(function (data) { return console.log("User: " + JSON.stringify(data)); })
40 | .catch(this.handleError);
41 | };
42 | return UserService;
43 | }());
44 | UserService = __decorate([
45 | core_1.Injectable(),
46 | __metadata("design:paramtypes", [http_1.Http])
47 | ], UserService);
48 | exports.UserService = UserService;
49 | //# sourceMappingURL=user.service.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/user.service.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"user.service.js","sourceRoot":"","sources":["user.service.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA2C;AAC3C,sCAA+C;AAC/C,8CAA6C;AAC7C,sCAAwD;AAKxD,IAAa,WAAW;IAIpB,qBAAoB,KAAW;QAAX,UAAK,GAAL,KAAK,CAAM;QAHvB,kBAAa,GAAG,iBAAiB,CAAC;QAClC,gBAAW,GAAG,eAAe,CAAC;IAEH,CAAC;IAE5B,iCAAW,GAAnB,UAAoB,KAAe;QAC/B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,CAAC,uBAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,cAAc,CAAC,CAAC;IAClE,CAAC;IAED,sCAAgB,GAAhB,UAAiB,IAAW;QACxB,IAAI,OAAO,GAAG,IAAI,cAAO,CAAC,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,kBAAkB;QACrF,IAAI,OAAO,GAAG,IAAI,qBAAc,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAEvD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;aACpE,GAAG,CAAC,UAAC,QAAkB,IAAK,OAAS,QAAQ,CAAC,IAAI,EAAE,EAAxB,CAAwB,CAAC;aACrD,EAAE,CAAC,UAAA,IAAI,IAAI,OAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAA5C,CAA4C,CAAC;aACxD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAGD,6BAAO,GAAP,UAAQ,IAAW;QACf,IAAI,OAAO,GAAG,IAAI,cAAO,CAAC,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,kBAAkB;QACrF,IAAI,OAAO,GAAG,IAAI,qBAAc,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAEvD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;aAClE,GAAG,CAAC,UAAC,QAAkB,IAAK,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAtB,CAAsB,CAAC;aACnD,EAAE,CAAC,UAAA,IAAI,IAAI,OAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAA5C,CAA4C,CAAC;aACxD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IACL,kBAAC;AAAD,CAAC,AA/BD,IA+BC;AA/BY,WAAW;IADvB,iBAAU,EAAE;qCAKkB,WAAI;GAJtB,WAAW,CA+BvB;AA/BY,kCAAW"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/user.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { Http, Response } from '@angular/http';
3 | import { Observable } from 'rxjs/Observable';
4 | import { Headers, RequestOptions } from '@angular/http';
5 | import { IUser } from './user';
6 | import { IResult } from './result';
7 |
8 | @Injectable()
9 | export class UserService {
10 | private _checkUserUrl = '/home/checkUser';
11 | private _addUserUrl = '/home/addUser';
12 |
13 | constructor(private _http: Http) { }
14 |
15 | private handleError(error: Response) {
16 | console.error(error);
17 | return Observable.throw(error.json().error || 'Server error');
18 | }
19 |
20 | isUserNameUnique(user: IUser): Observable {
21 | let headers = new Headers({ 'Content-Type': 'application/json' }); // for ASP.NET MVC
22 | let options = new RequestOptions({ headers: headers });
23 |
24 | return this._http.post(this._checkUserUrl, JSON.stringify(user), options)
25 | .map((response: Response) => response.json())
26 | .do(data => console.log("User: " + JSON.stringify(data)))
27 | .catch(this.handleError);
28 | }
29 |
30 |
31 | addUser(user: IUser): Observable {
32 | let headers = new Headers({ 'Content-Type': 'application/json' }); // for ASP.NET MVC
33 | let options = new RequestOptions({ headers: headers });
34 |
35 | return this._http.post(this._addUserUrl, JSON.stringify(user), options)
36 | .map((response: Response) => response.json())
37 | .do(data => console.log("User: " + JSON.stringify(data)))
38 | .catch(this.handleError);
39 | }
40 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/user.ts:
--------------------------------------------------------------------------------
1 | export interface IUser {
2 | id: number;
3 | name: string;
4 | email: string;
5 | password: string;
6 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/usernameValidators.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | var UsernameValidators = (function () {
4 | function UsernameValidators() {
5 | }
6 | UsernameValidators.cannotContainSpace = function (control) {
7 | if (control.value.indexOf(' ') >= 0) {
8 | return { cannotContainSpace: true };
9 | }
10 | return null;
11 | };
12 | return UsernameValidators;
13 | }());
14 | exports.UsernameValidators = UsernameValidators;
15 | //# sourceMappingURL=usernameValidators.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/usernameValidators.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"usernameValidators.js","sourceRoot":"","sources":["usernameValidators.ts"],"names":[],"mappings":";;AAEA;IAAA;IAOA,CAAC;IANU,qCAAkB,GAAzB,UAA0B,OAAoB;QAC1C,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClC,MAAM,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;QACxC,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;IAChB,CAAC;IACL,yBAAC;AAAD,CAAC,AAPD,IAOC;AAPY,gDAAkB"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/users/usernameValidators.ts:
--------------------------------------------------------------------------------
1 | import { FormControl } from '@angular/forms';
2 |
3 | export class UsernameValidators {
4 | static cannotContainSpace(control: FormControl) {
5 | if (control.value.indexOf(' ') >= 0) {
6 | return { cannotContainSpace: true };
7 | }
8 | return null;
9 | }
10 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/using-jquery-addons/using-jquery-addons.component.html:
--------------------------------------------------------------------------------
1 |
2 |
5 | {{item}} option
6 |
7 |
8 |
9 | {{selectedValue}}
--------------------------------------------------------------------------------
/MVC5Angular2/App/using-jquery-addons/using-jquery-addons.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | Object.defineProperty(exports, "__esModule", { value: true });
12 | var core_1 = require("@angular/core");
13 | var UsingJQueryAddonsComponent = (function () {
14 | function UsingJQueryAddonsComponent(_el) {
15 | this._el = _el;
16 | this.dropDownItems = ["First", "Second", "Third"];
17 | this.selectedValue = "Second";
18 | }
19 | UsingJQueryAddonsComponent.prototype.ngAfterViewInit = function () {
20 | var _this = this;
21 | jQuery(this._el.nativeElement)
22 | .find("select")
23 | .chosen()
24 | .on("change", function (e, args) {
25 | _this.selectedValue = args.selected;
26 | });
27 | };
28 | return UsingJQueryAddonsComponent;
29 | }());
30 | UsingJQueryAddonsComponent = __decorate([
31 | core_1.Component({
32 | templateUrl: "app/using-jquery-addons/using-jquery-addons.component.html"
33 | }),
34 | __metadata("design:paramtypes", [core_1.ElementRef])
35 | ], UsingJQueryAddonsComponent);
36 | exports.UsingJQueryAddonsComponent = UsingJQueryAddonsComponent;
37 | //# sourceMappingURL=using-jquery-addons.component.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/using-jquery-addons/using-jquery-addons.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"using-jquery-addons.component.js","sourceRoot":"","sources":["using-jquery-addons.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAqE;AAQrE,IAAa,0BAA0B;IAKnC,oCAAoB,GAAe;QAAf,QAAG,GAAH,GAAG,CAAY;QAHnC,kBAAa,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7C,kBAAa,GAAG,QAAQ,CAAC;IAGzB,CAAC;IAED,oDAAe,GAAf;QAAA,iBAOC;QANG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC;aACzB,IAAI,CAAC,QAAQ,CAAC;aACd,MAAM,EAAE;aACR,EAAE,CAAC,QAAQ,EAAE,UAAC,CAAC,EAAE,IAAI;YAClB,KAAI,CAAC,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC;QACvC,CAAC,CAAC,CAAC;IACX,CAAC;IACL,iCAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,0BAA0B;IAHtC,gBAAS,CAAC;QACP,WAAW,EAAE,4DAA4D;KAC5E,CAAC;qCAM2B,iBAAU;GAL1B,0BAA0B,CAgBtC;AAhBY,gEAA0B"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/using-jquery-addons/using-jquery-addons.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, ElementRef, AfterViewInit } from "@angular/core";
2 |
3 | // declare var jQuery: any; // untyped
4 | declare var jQuery: JQueryStatic; // typed
5 |
6 | @Component({
7 | templateUrl: "app/using-jquery-addons/using-jquery-addons.component.html"
8 | })
9 | export class UsingJQueryAddonsComponent implements AfterViewInit {
10 |
11 | dropDownItems = ["First", "Second", "Third"];
12 | selectedValue = "Second";
13 |
14 | constructor(private _el: ElementRef) {
15 | }
16 |
17 | ngAfterViewInit() {
18 | jQuery(this._el.nativeElement)
19 | .find("select")
20 | .chosen()
21 | .on("change", (e, args) => {
22 | this.selectedValue = args.selected;
23 | });
24 | }
25 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/using-third-party-libraries/typed-sha.component.html:
--------------------------------------------------------------------------------
1 | SHA-512 Hash / Typed
2 |
3 | String: This is a test
4 | HEX: {{hash}}
5 |
--------------------------------------------------------------------------------
/MVC5Angular2/App/using-third-party-libraries/typed-sha.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | Object.defineProperty(exports, "__esModule", { value: true });
9 | var core_1 = require("@angular/core");
10 | //import { jsSHA } from "jssha";
11 | var jsSHA = require("jssha"); // ===> var jsSHA = require("jssha"); // ===> loads `sha512.js` file dynamically using `systemjs.config.js` file definitions
12 | var TypedShaComponent = (function () {
13 | function TypedShaComponent() {
14 | }
15 | TypedShaComponent.prototype.ngOnInit = function () {
16 | var shaObj = new jsSHA("SHA-512", "TEXT");
17 | shaObj.update("This is a test");
18 | this.hash = shaObj.getHash("HEX");
19 | };
20 | return TypedShaComponent;
21 | }());
22 | TypedShaComponent = __decorate([
23 | core_1.Component({
24 | templateUrl: 'app/using-third-party-libraries/typed-sha.component.html'
25 | })
26 | ], TypedShaComponent);
27 | exports.TypedShaComponent = TypedShaComponent;
28 | //# sourceMappingURL=typed-sha.component.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/using-third-party-libraries/typed-sha.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"typed-sha.component.js","sourceRoot":"","sources":["typed-sha.component.ts"],"names":[],"mappings":";;;;;;;;AAAA,sCAAkD;AAClD,gCAAgC;AAChC,6BAA+B,CAAC,4HAA4H;AAK5J,IAAa,iBAAiB;IAA9B;IAQA,CAAC;IALG,oCAAQ,GAAR;QACI,IAAI,MAAM,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IACL,wBAAC;AAAD,CAAC,AARD,IAQC;AARY,iBAAiB;IAH7B,gBAAS,CAAC;QACP,WAAW,EAAE,0DAA0D;KAC1E,CAAC;GACW,iBAAiB,CAQ7B;AARY,8CAAiB"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/using-third-party-libraries/typed-sha.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | //import { jsSHA } from "jssha";
3 | import * as jsSHA from "jssha"; // ===> var jsSHA = require("jssha"); // ===> loads `sha512.js` file dynamically using `systemjs.config.js` file definitions
4 |
5 | @Component({
6 | templateUrl: 'app/using-third-party-libraries/typed-sha.component.html'
7 | })
8 | export class TypedShaComponent implements OnInit{
9 | hash: String;
10 |
11 | ngOnInit(): void {
12 | let shaObj = new jsSHA("SHA-512", "TEXT");
13 | shaObj.update("This is a test");
14 | this.hash = shaObj.getHash("HEX");
15 | }
16 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/using-third-party-libraries/untyped-sha.component.html:
--------------------------------------------------------------------------------
1 | SHA-512 Hash / UnTyped
2 |
3 | String: This is a test
4 | HEX: {{hash}}
5 |
--------------------------------------------------------------------------------
/MVC5Angular2/App/using-third-party-libraries/untyped-sha.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | Object.defineProperty(exports, "__esModule", { value: true });
9 | var core_1 = require("@angular/core");
10 | var jsSHA = require("jssha"); // ==> loads `sha512.js` file dynamically using `systemjs.config.js` file definitions
11 | //declare var jsSHA: any; // ==> this requires adding to the first page manually.
12 | var UnTypedShaComponent = (function () {
13 | function UnTypedShaComponent() {
14 | }
15 | UnTypedShaComponent.prototype.ngOnInit = function () {
16 | var shaObj = new jsSHA("SHA-512", "TEXT");
17 | shaObj.update("This is a test");
18 | this.hash = shaObj.getHash("HEX");
19 | };
20 | return UnTypedShaComponent;
21 | }());
22 | UnTypedShaComponent = __decorate([
23 | core_1.Component({
24 | templateUrl: 'app/using-third-party-libraries/untyped-sha.component.html'
25 | })
26 | ], UnTypedShaComponent);
27 | exports.UnTypedShaComponent = UnTypedShaComponent;
28 | //# sourceMappingURL=untyped-sha.component.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/using-third-party-libraries/untyped-sha.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"untyped-sha.component.js","sourceRoot":"","sources":["untyped-sha.component.ts"],"names":[],"mappings":";;;;;;;;AAAA,sCAAkD;AAElD,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,qFAAqF;AACnH,0IAA0I;AAK1I,IAAa,mBAAmB;IAAhC;IAQA,CAAC;IALG,sCAAQ,GAAR;QACI,IAAI,MAAM,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IACL,0BAAC;AAAD,CAAC,AARD,IAQC;AARY,mBAAmB;IAH/B,gBAAS,CAAC;QACP,WAAW,EAAE,4DAA4D;KAC5E,CAAC;GACW,mBAAmB,CAQ/B;AARY,kDAAmB"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/using-third-party-libraries/untyped-sha.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | var jsSHA = require("jssha"); // ==> loads `sha512.js` file dynamically using `systemjs.config.js` file definitions
4 | //declare var jsSHA: any; // ==> this requires adding to the first page manually.
5 |
6 | @Component({
7 | templateUrl: 'app/using-third-party-libraries/untyped-sha.component.html'
8 | })
9 | export class UnTypedShaComponent implements OnInit {
10 | hash: String;
11 |
12 | ngOnInit(): void {
13 | let shaObj = new jsSHA("SHA-512", "TEXT");
14 | shaObj.update("This is a test");
15 | this.hash = shaObj.getHash("HEX");
16 | }
17 | }
--------------------------------------------------------------------------------
/MVC5Angular2/App/vendor.js:
--------------------------------------------------------------------------------
1 | /*
2 | // Angular 2
3 | import '@angular/platform-browser';
4 | import '@angular/platform-browser-dynamic';
5 | import '@angular/core';
6 | import '@angular/common';
7 | import '@angular/http';
8 | import '@angular/router-deprecated';
9 | // RxJS
10 | import 'rxjs';
11 | // Other vendors for example jQuery, Lodash or Bootstrap
12 | // You can import js, ts, css, sass, ...
13 | */ //for webpack
14 | //# sourceMappingURL=vendor.js.map
--------------------------------------------------------------------------------
/MVC5Angular2/App/vendor.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"vendor.js","sourceRoot":"","sources":["vendor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;EAYE,CAAA,aAAa"}
--------------------------------------------------------------------------------
/MVC5Angular2/App/vendor.ts:
--------------------------------------------------------------------------------
1 | /*
2 | // Angular 2
3 | import '@angular/platform-browser';
4 | import '@angular/platform-browser-dynamic';
5 | import '@angular/core';
6 | import '@angular/common';
7 | import '@angular/http';
8 | import '@angular/router-deprecated';
9 | // RxJS
10 | import 'rxjs';
11 | // Other vendors for example jQuery, Lodash or Bootstrap
12 | // You can import js, ts, css, sass, ...
13 | *///for webpack
14 |
--------------------------------------------------------------------------------
/MVC5Angular2/App_Start/RouteConfig.cs:
--------------------------------------------------------------------------------
1 | using System.Web.Mvc;
2 | using System.Web.Routing;
3 |
4 | namespace MVC5Angular2
5 | {
6 | public static class RouteConfig
7 | {
8 | public static void RegisterRoutes(RouteCollection routes)
9 | {
10 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
11 |
12 | routes.MapRoute(
13 | name: "Default",
14 | url: "{controller}/{action}/{id}",
15 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
16 | constraints: new { controller = "Home" } // for catch all to work
17 | );
18 |
19 | // Route override to work with Angularjs and HTML5 routing
20 | routes.MapRoute(
21 | name: "NotFound",
22 | url: "{*catchall}",
23 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
24 | );
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/MVC5Angular2/Content/Site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Set padding to keep content from hitting the edges */
7 | .body-content {
8 | padding-left: 15px;
9 | padding-right: 15px;
10 | }
11 |
12 | /* Set width on the form input elements since they're 100% wide by default */
13 | input,
14 | select,
15 | textarea {
16 | max-width: 280px;
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/MVC5Angular2/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Web.Mvc;
5 | using MVC5Angular2.Models;
6 | using Newtonsoft.Json;
7 | using Newtonsoft.Json.Serialization;
8 |
9 | namespace MVC5Angular2.Controllers
10 | {
11 | public class HomeController : Controller
12 | {
13 | // GET: Home
14 | public ActionResult Index()
15 | {
16 | //return Redirect("~/dist"); //webpack
17 | return View();
18 | }
19 |
20 | public ActionResult Products()
21 | {
22 | var products = new List
23 | {
24 | new Product
25 | {
26 | ProductId= 2,
27 | ProductName= "Garden Cart",
28 | ProductCode= "GDN-0023",
29 | ReleaseDate= "March 18, 2016",
30 | Description= "15 gallon capacity rolling garden cart",
31 | Price= (decimal) 32.99,
32 | StarRating= 4.2,
33 | ImageUrl= "app/assets/images/garden_cart.png"
34 | },
35 | new Product
36 | {
37 | ProductId= 5,
38 | ProductName= "Hammer",
39 | ProductCode= "TBX-0048",
40 | ReleaseDate= "May 21, 2016",
41 | Description= "Curved claw steel hammer",
42 | Price= (decimal) 8.9,
43 | StarRating= 4.8,
44 | ImageUrl= "app/assets/images/rejon_Hammer.png"
45 | }
46 | };
47 |
48 | return new ContentResult
49 | {
50 | Content = JsonConvert.SerializeObject(products, new JsonSerializerSettings
51 | {
52 | ContractResolver = new CamelCasePropertyNamesContractResolver()
53 | }),
54 | ContentType = "application/json",
55 | ContentEncoding = Encoding.UTF8
56 | };
57 | }
58 |
59 | [HttpPost]
60 | public ActionResult AddProduct(Product product)
61 | {
62 | product.ProductId = 1; //todo: save product and get id from db
63 |
64 | return new ContentResult
65 | {
66 | Content = JsonConvert.SerializeObject(product, new JsonSerializerSettings
67 | {
68 | ContractResolver = new CamelCasePropertyNamesContractResolver()
69 | }),
70 | ContentType = "application/json",
71 | ContentEncoding = Encoding.UTF8
72 | };
73 | }
74 |
75 |
76 | [HttpPost]
77 | public ActionResult AddUser(User user)
78 | {
79 | user.Id = 1; //todo: save user and get id from db
80 |
81 | return new ContentResult
82 | {
83 | Content = JsonConvert.SerializeObject(user, new JsonSerializerSettings
84 | {
85 | ContractResolver = new CamelCasePropertyNamesContractResolver()
86 | }),
87 | ContentType = "application/json",
88 | ContentEncoding = Encoding.UTF8
89 | };
90 | }
91 |
92 |
93 | [HttpPost]
94 | public ActionResult CheckUser(User user)
95 | {
96 | var isUnique = new { result = true };
97 | if (user.Name?.Equals("Vahid", StringComparison.OrdinalIgnoreCase) ?? false)
98 | {
99 | isUnique = new { result = false };
100 | }
101 |
102 | return new ContentResult
103 | {
104 | Content = JsonConvert.SerializeObject(isUnique, new JsonSerializerSettings
105 | {
106 | ContractResolver = new CamelCasePropertyNamesContractResolver()
107 | }),
108 | ContentType = "application/json",
109 | ContentEncoding = Encoding.UTF8
110 | };
111 | }
112 | }
113 | }
--------------------------------------------------------------------------------
/MVC5Angular2/Global.asax:
--------------------------------------------------------------------------------
1 | <%@ Application Codebehind="Global.asax.cs" Inherits="MVC5Angular2.MvcApplication" Language="C#" %>
2 |
--------------------------------------------------------------------------------
/MVC5Angular2/Global.asax.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.Mvc;
6 | using System.Web.Routing;
7 |
8 | namespace MVC5Angular2
9 | {
10 | public class MvcApplication : System.Web.HttpApplication
11 | {
12 | protected void Application_Start()
13 | {
14 | AreaRegistration.RegisterAllAreas();
15 | RouteConfig.RegisterRoutes(RouteTable.Routes);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/MVC5Angular2/MVC5Angular2.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Debug
7 | AnyCPU
8 |
9 |
10 | 2.0
11 | {2D3B9969-C179-46E5-B9A7-60FE5025FB17}
12 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
13 | Library
14 | Properties
15 | MVC5Angular2
16 | MVC5Angular2
17 | v4.5
18 | true
19 |
20 |
21 |
22 |
23 |
24 | 2.2
25 |
26 |
27 | true
28 | full
29 | false
30 | bin\
31 | DEBUG;TRACE
32 | prompt
33 | 4
34 |
35 |
36 | pdbonly
37 | true
38 | bin\
39 | TRACE
40 | prompt
41 | 4
42 |
43 |
44 |
45 |
46 | ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll
47 | True
48 |
49 |
50 | ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll
51 | True
52 |
53 |
54 | ..\packages\routedebugger.2.1.5\lib\net40\RouteDebugger.dll
55 | True
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll
68 | True
69 |
70 |
71 | ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll
72 | True
73 |
74 |
75 | ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll
76 | True
77 |
78 |
79 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll
80 | True
81 |
82 |
83 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll
84 | True
85 |
86 |
87 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll
88 | True
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 | Global.asax
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 | Designer
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 | 10.0
206 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
207 |
208 |
209 | True
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 | True
220 | True
221 | 3583
222 | /
223 | http://localhost:2222/
224 | False
225 | False
226 |
227 |
228 | False
229 |
230 |
231 |
232 |
233 |
240 |
--------------------------------------------------------------------------------
/MVC5Angular2/Models/Product.cs:
--------------------------------------------------------------------------------
1 | namespace MVC5Angular2.Models
2 | {
3 | public class Product
4 | {
5 | public int ProductId { set; get; }
6 | public string ProductName { set; get; }
7 | public string ProductCode { set; get; }
8 | public string ReleaseDate { set; get; }
9 | public decimal Price { set; get; }
10 | public string Description { set; get; }
11 | public double StarRating { set; get; }
12 | public string ImageUrl { set; get; }
13 | }
14 | }
--------------------------------------------------------------------------------
/MVC5Angular2/Models/User.cs:
--------------------------------------------------------------------------------
1 | namespace MVC5Angular2.Models
2 | {
3 | public class User
4 | {
5 | public int Id { set; get; }
6 | public string Name { set; get; }
7 | public string Email { set; get; }
8 | public string Password { set; get; }
9 | }
10 | }
--------------------------------------------------------------------------------
/MVC5Angular2/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("MVC5Angular2")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("MVC5Angular2")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("2d3b9969-c179-46e5-b9a7-60fe5025fb17")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/MVC5Angular2/Views/Home/Index.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "~/Views/Shared/_LayoutSystemJs.cshtml";
3 | ViewBag.Title = "Index";
4 | }
--------------------------------------------------------------------------------
/MVC5Angular2/Views/Shared/_LayoutGulp.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | @ViewBag.Title - My ASP.NET Application
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | @RenderBody()
19 |
Loading App...
20 |
21 |
22 |
23 |
24 |
25 |
26 | @RenderSection("Scripts", required: false)
27 |
28 |
--------------------------------------------------------------------------------
/MVC5Angular2/Views/Shared/_LayoutSystemJs.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | @ViewBag.Title - My ASP.NET Application
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
31 |
32 |
33 |
34 |
35 | @RenderBody()
36 |
Loading App...
37 |
38 |
39 |
40 | @RenderSection("Scripts", required: false)
41 |
42 |
--------------------------------------------------------------------------------
/MVC5Angular2/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "~/Views/Shared/_LayoutSystemJs.cshtml";
3 | }
--------------------------------------------------------------------------------
/MVC5Angular2/Views/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/MVC5Angular2/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/MVC5Angular2/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "asp-net-mvc5x-angular2x",
3 | "version": "1.0.0",
4 | "authors": [
5 | "DNT"
6 | ],
7 | "license": "MIT",
8 | "ignore": [
9 | "node_modules",
10 | "bower_components"
11 | ],
12 | "dependencies": {
13 | "chosen": "1.4.2"
14 | },
15 | "devDependencies": {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/MVC5Angular2/config/helpers.js:
--------------------------------------------------------------------------------
1 | var path = require('path');
2 | var _root = path.resolve(__dirname, '..');
3 | function root(args) {
4 | args = Array.prototype.slice.call(arguments, 0);
5 | return path.join.apply(path, [_root].concat(args));
6 | }
7 | exports.root = root;
--------------------------------------------------------------------------------
/MVC5Angular2/config/karma-test-shim.js:
--------------------------------------------------------------------------------
1 | Error.stackTraceLimit = Infinity;
2 |
3 | require('es6-shim');
4 | require('reflect-metadata');
5 |
6 | require('zone.js/dist/zone');
7 | require('zone.js/dist/long-stack-trace-zone');
8 | require('zone.js/dist/jasmine-patch');
9 | require('zone.js/dist/async-test');
10 |
11 | var appContext = require.context('../app', true, /\.spec\.ts/);
12 |
13 | appContext.keys().forEach(appContext);
14 |
15 | var testing = require('@angular/core/testing');
16 | var browser = require('@angular/platform-browser-dynamic/testing');
17 |
18 | testing.setBaseTestProviders(
19 | browser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
20 | browser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
21 | );
--------------------------------------------------------------------------------
/MVC5Angular2/config/karma.conf.js:
--------------------------------------------------------------------------------
1 | var webpackConfig = require('./webpack.test');
2 |
3 | module.exports = function (config) {
4 | var _config = {
5 | basePath: '',
6 |
7 | frameworks: ['jasmine'],
8 |
9 | files: [
10 | { pattern: './config/karma-test-shim.js', watched: false }
11 | ],
12 |
13 | preprocessors: {
14 | './config/karma-test-shim.js': ['webpack', 'sourcemap']
15 | },
16 |
17 | webpack: webpackConfig,
18 |
19 | webpackMiddleware: {
20 | stats: 'errors-only'
21 | },
22 |
23 | webpackServer: {
24 | noInfo: true
25 | },
26 |
27 | reporters: ['progress'],
28 | port: 9876,
29 | colors: true,
30 | logLevel: config.LOG_INFO,
31 | autoWatch: false,
32 | browsers: ['PhantomJS'],
33 | singleRun: true
34 | };
35 |
36 | config.set(_config);
37 | };
--------------------------------------------------------------------------------
/MVC5Angular2/config/webpack.common.js:
--------------------------------------------------------------------------------
1 | var webpack = require('webpack');
2 | var HtmlWebpackPlugin = require('html-webpack-plugin');
3 | var ExtractTextPlugin = require('extract-text-webpack-plugin');
4 | var helpers = require('./helpers');
5 |
6 | module.exports = {
7 | entry: {
8 | 'polyfills': './app/polyfills.ts',
9 | 'vendor': './app/vendor.ts',
10 | 'app': './app/main.ts'
11 | },
12 |
13 | resolve: {
14 | extensions: ['', '.js', '.ts']
15 | },
16 |
17 | module: {
18 | loaders: [
19 | {
20 | test: /\.ts$/,
21 | loader: 'ts'
22 | },
23 | {
24 | test: /\.html$/,
25 | loader: 'html'
26 | },
27 | {
28 | test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
29 | loader: 'file?name=assets/[name].[hash].[ext]'
30 | },
31 | {
32 | test: /\.css$/,
33 | exclude: helpers.root('app', 'app'),
34 | loader: ExtractTextPlugin.extract('style', 'css?sourceMap')
35 | },
36 | {
37 | test: /\.css$/,
38 | include: helpers.root('app', 'app'),
39 | loader: 'raw'
40 | }
41 | ]
42 | },
43 |
44 | plugins: [
45 | new webpack.optimize.CommonsChunkPlugin({
46 | name: ['app', 'vendor', 'polyfills']
47 | }),
48 |
49 | new HtmlWebpackPlugin({
50 | template: 'app/index.html'
51 | })
52 | ]
53 | };
--------------------------------------------------------------------------------
/MVC5Angular2/config/webpack.dev.js:
--------------------------------------------------------------------------------
1 | var webpackMerge = require('webpack-merge');
2 | var ExtractTextPlugin = require('extract-text-webpack-plugin');
3 | var commonConfig = require('./webpack.common.js');
4 | var helpers = require('./helpers');
5 |
6 | module.exports = webpackMerge(commonConfig, {
7 | devtool: 'cheap-module-eval-source-map',
8 |
9 | output: {
10 | path: helpers.root('dist'),
11 | publicPath: 'http://localhost:2222/dist/',
12 | filename: '[name].js',
13 | chunkFilename: '[id].chunk.js'
14 | },
15 |
16 | plugins: [
17 | new ExtractTextPlugin('[name].css')
18 | ],
19 |
20 | devServer: {
21 | historyApiFallback: true,
22 | stats: 'minimal'
23 | }
24 | });
--------------------------------------------------------------------------------
/MVC5Angular2/config/webpack.prod.js:
--------------------------------------------------------------------------------
1 | var webpack = require('webpack');
2 | var webpackMerge = require('webpack-merge');
3 | var ExtractTextPlugin = require('extract-text-webpack-plugin');
4 | var commonConfig = require('./webpack.common.js');
5 | var helpers = require('./helpers');
6 |
7 | const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
8 |
9 | module.exports = webpackMerge(commonConfig, {
10 | devtool: 'source-map',
11 |
12 | output: {
13 | path: helpers.root('dist'),
14 | publicPath: '/',
15 | filename: '[name].[hash].js',
16 | chunkFilename: '[id].[hash].chunk.js'
17 | },
18 |
19 | htmlLoader: {
20 | minimize: false // workaround for ng2
21 | },
22 |
23 | plugins: [
24 | new webpack.NoErrorsPlugin(),
25 | new webpack.optimize.DedupePlugin(),
26 | new webpack.optimize.UglifyJsPlugin(),
27 | new ExtractTextPlugin('[name].[hash].css'),
28 | new webpack.DefinePlugin({
29 | 'process.env': {
30 | 'ENV': JSON.stringify(ENV)
31 | }
32 | })
33 | ]
34 | });
--------------------------------------------------------------------------------
/MVC5Angular2/config/webpack.test.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devtools: 'source-map',
3 |
4 | resolve: {
5 | extensions: ['', '.ts', '.js']
6 | },
7 |
8 | module: {
9 | loaders: [
10 | {
11 | test: /\.ts$/,
12 | loader: 'ts'
13 | },
14 | {
15 | test: /\.html$/,
16 | loader: 'html'
17 |
18 | },
19 | {
20 | test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
21 | loader: 'null'
22 | },
23 | {
24 | test: /\.css$/,
25 | loader: 'null'
26 | }
27 | ]
28 | }
29 | }
--------------------------------------------------------------------------------
/MVC5Angular2/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VahidN/MVC5Angular2/81789f3c9010978ca6c6a799d57db9fe3e78990b/MVC5Angular2/favicon.ico
--------------------------------------------------------------------------------
/MVC5Angular2/gulpfile.js:
--------------------------------------------------------------------------------
1 | var gulp = require("gulp"),
2 | concat = require("gulp-concat"),
3 | tsc = require("gulp-typescript"),
4 | jsMinify = require("gulp-uglify"),
5 | cssPrefixer = require("gulp-autoprefixer"),
6 | cssMinify = require("gulp-cssnano"),
7 | del = require("del"),
8 | merge = require("merge-stream"),
9 | minifyHTML = require('gulp-htmlmin'),
10 | embedTemplates = require('gulp-angular-embed-templates'),
11 | SystemBuilder = require("systemjs-builder");
12 |
13 | var appFolder = "./app";
14 | var outFolder = "wwwroot";
15 |
16 | gulp.task("clean", () => {
17 | return del(outFolder);
18 | });
19 |
20 | gulp.task("shims", () => {
21 | return gulp.src([
22 | "node_modules/core-js/client/shim.min.js",
23 | "node_modules/zone.js/dist/zone.js",
24 | "node_modules/reflect-metadata/Reflect.js"
25 | ])
26 | .pipe(concat("shims.js"))
27 | .pipe(jsMinify())
28 | .pipe(gulp.dest(outFolder + "/js/"));
29 | });
30 |
31 | gulp.task("tsc", () => {
32 | var tsProject = tsc.createProject("./tsconfig.json");
33 | var tsResult = gulp.src([appFolder + "/**/*.ts"])
34 | .pipe(embedTemplates({
35 | debug: true,
36 | basePath: "./",
37 | sourceType: "ts",
38 | minimize: {
39 | empty: true,
40 | spare: true,
41 | quotes: true,
42 | dom: {
43 | xmlMode: true,
44 | lowerCaseAttributeNames: false,
45 | lowerCaseTags: false
46 | }
47 | }
48 | })) // inline templates
49 | .pipe(tsc(tsProject), undefined, tsc.reporter.fullReporter());
50 |
51 | return tsResult.js.pipe(gulp.dest(appFolder));
52 | });
53 |
54 | gulp.task("system-build", ["tsc"], () => {
55 | var builder = new SystemBuilder();
56 |
57 | return builder.loadConfig("systemjs.config.js")
58 | .then(() => builder.buildStatic(appFolder, outFolder + "/js/bundle.js"));
59 | });
60 |
61 |
62 | gulp.task("buildAndMinify", ["system-build"], () => {
63 | var bundle = gulp.src(outFolder + "/js/bundle.js")
64 | .pipe(jsMinify())
65 | .pipe(gulp.dest(outFolder + "/js/"));
66 |
67 | var css = gulp.src(outFolder + "/css/styles.css")
68 | .pipe(cssMinify())
69 | .pipe(gulp.dest(outFolder + "/css/"));
70 |
71 | return merge(bundle, css);
72 | });
73 |
74 |
75 | gulp.task("favicon", function () {
76 | return gulp.src(appFolder + "/favicon.ico")
77 | .pipe(gulp.dest(outFolder));
78 | });
79 |
80 | gulp.task("css", function () {
81 | return gulp.src(appFolder + "/**/*.css")
82 | .pipe(cssPrefixer())
83 | .pipe(cssMinify())
84 | .pipe(gulp.dest(outFolder));
85 | });
86 |
87 | gulp.task("templates", function () {
88 | // in-line templates using .... gulp-angular-embed-templates
89 | //return gulp.src(appFolder + "/**/*.html")
90 | // .pipe(minifyHTML())
91 | // .pipe(gulp.dest(outFolder));
92 | });
93 |
94 | gulp.task("assets", ["templates", "css", "favicon"], function () {
95 | return gulp.src(appFolder + "/**/*.png")
96 | .pipe(gulp.dest(outFolder));
97 | });
98 |
99 |
100 | gulp.task("otherScriptsAndStyles", () => {
101 | gulp.src([
102 | "jquery/dist/jquery.*js",
103 | "bootstrap/dist/js/bootstrap*.js"
104 | ], {
105 | cwd: "node_modules/**"
106 | })
107 | .pipe(gulp.dest(outFolder + "/js/"));
108 |
109 | gulp.src([
110 | "node_modules/bootstrap/dist/css/bootstrap.css"
111 | ]).pipe(cssMinify()).pipe(gulp.dest(outFolder + "/css/"));
112 |
113 | gulp.src([
114 | "node_modules/bootstrap/fonts/*.*"
115 | ]).pipe(gulp.dest(outFolder + "/fonts/"));
116 | });
117 |
118 |
119 | //gulp.task("watch.tsc", ["tsc"], function () {
120 | // return gulp.watch(appFolder + "/**/*.ts", ["tsc"]);
121 | //});
122 |
123 | //gulp.task("watch", ["watch.tsc"]);
124 |
125 |
126 | gulp.task("default", [
127 | "shims",
128 | "buildAndMinify",
129 | "assets",
130 | "otherScriptsAndStyles"
131 | //,"watch"
132 | ]);
--------------------------------------------------------------------------------
/MVC5Angular2/karma.conf.js:
--------------------------------------------------------------------------------
1 | module.exports = require('./config/karma.conf.js');
--------------------------------------------------------------------------------
/MVC5Angular2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "asp-net-mvc5x-angular2x",
3 | "version": "1.0.0",
4 | "author": "DNT",
5 | "description": "",
6 | "scripts": {
7 | },
8 | "license": "Apache-2.0",
9 | "dependencies": {
10 | "@angular/common": "~4.0.0",
11 | "@angular/compiler": "~4.0.0",
12 | "@angular/core": "~4.0.0",
13 | "@angular/http": "~4.0.0",
14 | "@angular/platform-browser": "~4.0.0",
15 | "@angular/platform-browser-dynamic": "~4.0.0",
16 | "@angular/router": "~4.0.0",
17 | "@angular/forms": "~4.0.0",
18 | "angular-in-memory-web-api": "~0.3.0",
19 | "bootstrap": "^3.3.6",
20 | "core-js": "^2.4.1",
21 | "jquery": "^2.2.3",
22 | "jssha": "^2.1.0",
23 | "reflect-metadata": "^0.1.8",
24 | "rxjs": "5.0.1",
25 | "systemjs": "0.19.40",
26 | "zone.js": "^0.8.4"
27 | },
28 | "devDependencies": {
29 | "css-loader": "^0.23.1",
30 | "del": "^2.2.0",
31 | "extract-text-webpack-plugin": "^1.0.1",
32 | "file-loader": "^0.8.5",
33 | "fs": "^0.0.2",
34 | "gulp": "^3.9.1",
35 | "gulp-util": "^3.0.6",
36 | "htmlparser2": "~3.9.0",
37 | "minimize": "^1.8.1",
38 | "through2": "^2.0.1",
39 |
40 | "gulp-angular-embed-templates": "^2.2.0",
41 | "gulp-autoprefixer": "^3.1.0",
42 | "gulp-clean": "^0.3.2",
43 | "gulp-concat": "^2.6.0",
44 | "gulp-cssnano": "^2.0.0",
45 | "gulp-html-replace": "^1.5.4",
46 | "gulp-htmlmin": "^1.0.5",
47 | "gulp-tsc": "^1.1.5",
48 | "gulp-typescript": "^2.13.1",
49 | "gulp-uglify": "^1.5.3",
50 | "html-loader": "^0.4.3",
51 | "html-webpack-plugin": "^2.15.0",
52 | "jasmine-core": "^2.4.1",
53 | "karma": "^1.3.0",
54 | "karma-jasmine": "^0.3.8",
55 | "karma-phantomjs-launcher": "^1.0.0",
56 | "karma-sourcemap-loader": "^0.3.7",
57 | "karma-webpack": "^1.7.0",
58 | "merge-stream": "^1.0.0",
59 | "null-loader": "^0.1.1",
60 | "path": "^0.12.7",
61 | "phantomjs-prebuilt": "^2.1.7",
62 | "raw-loader": "^0.5.1",
63 | "style-loader": "^0.13.1",
64 | "systemjs-builder": "^0.15.16",
65 | "ts-loader": "^0.8.1",
66 | "typescript": "^2.1.0",
67 | "typings": "^1.0.4",
68 | "webpack": "^1.12.14",
69 | "webpack-dev-server": "^1.14.1",
70 | "webpack-merge": "^0.9.0",
71 | "canonical-path": "0.0.2",
72 | "http-server": "^0.9.0",
73 | "tslint": "^3.15.1",
74 | "lodash": "^4.16.4",
75 | "karma-chrome-launcher": "^0.2.3",
76 | "karma-cli": "^0.1.2",
77 | "karma-htmlfile-reporter": "^0.2.2",
78 | "protractor": "4.0.9",
79 | "rimraf": "^2.5.2",
80 |
81 | "@types/core-js": "^0.9.34",
82 | "@types/node": "^6.0.46",
83 | "@types/jasmine": "^2.5.36",
84 | "@types/selenium-webdriver": "^2.53.33",
85 | "@types/jssha": "",
86 | "@types/jquery": ""
87 |
88 | },
89 | "repository": { }
90 | }
91 |
--------------------------------------------------------------------------------
/MVC5Angular2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/MVC5Angular2/systemjs.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * System configuration for Angular 2 samples
3 | * Adjust as necessary for your application needs.
4 | */
5 | (function (global) {
6 | System.config({
7 | paths: {
8 | // paths serve as alias
9 | 'npm:': 'node_modules/'
10 | },
11 | // map tells the System loader where to look for things
12 | map: {
13 | // our app is within the app folder
14 | app: 'app',
15 |
16 | // angular bundles
17 | '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
18 | '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
19 | '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
20 | '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
21 | '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
22 | '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
23 | '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
24 | '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
25 |
26 | // other libraries
27 | 'rxjs': 'npm:rxjs',
28 | 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
29 | 'jssha': 'npm:jssha/src'
30 | },
31 | // packages tells the System loader how to load when no filename and/or no extension
32 | packages: {
33 | app: {
34 | main: './main.js',
35 | defaultExtension: 'js'
36 | },
37 | rxjs: {
38 | defaultExtension: 'js'
39 | },
40 | 'angular-in-memory-web-api': {
41 | main: './index.js',
42 | defaultExtension: 'js'
43 | },
44 | 'jssha': {
45 | main: './sha512.js',
46 | defaultExtension: 'js'
47 | }
48 | }
49 | });
50 | })(this);
--------------------------------------------------------------------------------
/MVC5Angular2/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "es5",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "noEmitOnError": true,
8 | "removeComments": false,
9 | "sourceMap": true,
10 | "emitDecoratorMetadata": true,
11 | "experimentalDecorators": true,
12 | "noImplicitAny": false,
13 | "suppressImplicitAnyIndexErrors": true,
14 | "strictNullChecks": false,
15 | "typeRoots": [
16 | "./node_modules/@types/"
17 | ]
18 | //,"lib": [ "es2015", "dom" ]
19 | },
20 | "exclude": [
21 | "node_modules",
22 | "wwwroot",
23 | "typings/main",
24 | "typings/main.d.ts",
25 | "bower_components",
26 | "**/*-aot.ts"
27 | ]
28 | }
--------------------------------------------------------------------------------
/MVC5Angular2/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "class-name": true,
4 | "comment-format": [
5 | true,
6 | "check-space"
7 | ],
8 | "curly": true,
9 | "eofline": true,
10 | "forin": true,
11 | "indent": [
12 | true,
13 | "spaces"
14 | ],
15 | "label-position": true,
16 | "label-undefined": true,
17 | "max-line-length": [
18 | true,
19 | 140
20 | ],
21 | "member-access": false,
22 | "member-ordering": [
23 | true,
24 | "static-before-instance",
25 | "variables-before-functions"
26 | ],
27 | "no-arg": true,
28 | "no-bitwise": true,
29 | "no-console": [
30 | true,
31 | "debug",
32 | "info",
33 | "time",
34 | "timeEnd",
35 | "trace"
36 | ],
37 | "no-construct": true,
38 | "no-debugger": true,
39 | "no-duplicate-key": true,
40 | "no-duplicate-variable": true,
41 | "no-empty": false,
42 | "no-eval": true,
43 | "no-inferrable-types": true,
44 | "no-shadowed-variable": true,
45 | "no-string-literal": false,
46 | "no-switch-case-fall-through": true,
47 | "no-trailing-whitespace": true,
48 | "no-unused-expression": true,
49 | "no-unused-variable": true,
50 | "no-unreachable": true,
51 | "no-use-before-declare": true,
52 | "no-var-keyword": true,
53 | "object-literal-sort-keys": false,
54 | "one-line": [
55 | true,
56 | "check-open-brace",
57 | "check-catch",
58 | "check-else",
59 | "check-whitespace"
60 | ],
61 | "quotemark": [
62 | true,
63 | "single"
64 | ],
65 | "radix": true,
66 | "semicolon": [
67 | "always"
68 | ],
69 | "triple-equals": [
70 | true,
71 | "allow-null-check"
72 | ],
73 | "typedef-whitespace": [
74 | true,
75 | {
76 | "call-signature": "nospace",
77 | "index-signature": "nospace",
78 | "parameter": "nospace",
79 | "property-declaration": "nospace",
80 | "variable-declaration": "nospace"
81 | }
82 | ],
83 | "variable-name": false,
84 | "whitespace": [
85 | true,
86 | "check-branch",
87 | "check-decl",
88 | "check-operator",
89 | "check-separator",
90 | "check-type"
91 | ]
92 | }
93 | }
--------------------------------------------------------------------------------
/MVC5Angular2/webpack.config.js:
--------------------------------------------------------------------------------
1 | module.exports = require('./config/webpack.dev.js');
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Using AngularJS 2.0 with ASP.NET MVC 5.x
2 |
--------------------------------------------------------------------------------