Write Angular apps with pleasure on Kotlin
☺️
Benefits:
- Kotlin itself ✨ with no
;
, nothis
,null
safety - Fully customizable webpack
- Support of Multiplatform Projects
- Support of kotlinx.coroutines, Ktor, kotlinx.serialization
- Fully customizable CLI
@Component(
selector = "app-root",
template = """
<p>
Welcome to {{title}}!
</p>
""",
styles = []
)
class AppComponent : OnInit {
var title = "example"
override fun ngOnInit() {
}
}
@NgModule
class AppModule {
companion object : NgModuleKt(
declarations = arrayOf(
AppComponent::class.js
),
imports = arrayOf(
BrowserModule::class.js
),
providers = emptyArray(),
bootstrap = arrayOf(AppComponent::class.js)
)
}
fun main() {
AngularKt.bootstrap<AppModule>()
}
Isn't that awesome? By the way, currently kotlin js does not
support classes in annotations, so somewhere additional code
like companion object : <annotation>Kt
is required
As you may have guessed, it is now impossible to use Angular CLI.
The gradle plugin can be used as a replacement, which currently supports
the generate command. For example, in order to generate a service,
you should execute $ sh gradlew generate service
or shorter
$ sh gradlew g service
or even shorter $ sh gradlew service
Sorry, tools are available only for Linux (may be also MacOS)
First you need to setup environment
$ bash tools/setup.sh
$ bash tools/build.sh
All issues and pull requests are welcome.
If you need an idea, look for // todo
comments in code
Thank you in advance
Thanks Google for its great framework
Special thanks these guys. Awesome job!
- MpApt - Kotlin (Native/JS/JVM) Annotation Processor library by @Foso
- Kotling Angular by @Yegair
- Angular-Kotlin Starter App by @gbaldeck
This project is licensed under the Apache License, Version 2.0
See the LICENSE.txt file for more details
Copyright 2020 Vlad Kalyuzhnyu
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.