SlideShare a Scribd company logo
Scal`a`ngularScal`a`ngular
Harsh Sharma Khandal
Software Consultant
Knoldus Software LLP
What is Scal`a`ngular?
● A term composed of Scala and Angular JS
● A relationship, a handshake between Scala and
Angular JS
● Way to build AngularJS based applications in type safe
manner with Scala
● Way to provide the bindings to core AngularJS classes
and functions
● A term composed of Scala and Angular JS
● A relationship, a handshake between Scala and
Angular JS
● Way to build AngularJS based applications in type safe
manner with Scala
● Way to provide the bindings to core AngularJS classes
and functions
Requirements in SBT
● Add the following dependency and resolves in the
sbt file,
"com.greencatsoft" %%%! "scalajs-angular" % "0.8-SNAPSHOT"
resolvers += Resolver.sonatypeRepo("snapshots")
Defining Angular JS app
Scala provides Angular JS app to be defined by
registering the structures and code blocks in two ways,
● By registering the classes
● By registering the singleton objects
Registering the classes
Angular.module("todomvc")
.controller[TodoCtrl]
.directive[TodoItemDirective]
.directive[EscapeDirective]
.directive[FocusDirective]
.filter[StatusFilter]
.factory[TaskServiceProxy.Factory]
Registering the singleton objects
Angular.module("todomvc")
.controller(TodoCtrl)
.directive(TodoItemDirective)
.directive(EscapeDirective)
.directive(FocusDirective)
.filter(StatusFilter)
.factory(TaskServiceProxy.Factory)
Injectable Services
Injectable services can be defined as follows,
● Controllers,
● Factories,
● Directives,
● Filters
Defining a Service
● Any service we define must be inherited from its
parent trait Service,
● In injectable services like, we use the @injectable to
specify the name of service
Services
@injectable("todoUser")
class UserDirective extends AttributeDirective {
...
}
Factory
@injectable("taskService")
class TaskService(http: HttpService) extends Service {
...
}
@injectable("taskService")
class TaskServiceFactory(http: HttpService) extends
Factory[TaskService] {
...
}
Controllers and Scopes
● Controller is a special angular JS service, used to
communicate with template by manipulating a scope
object
● In Scala, scope declares a set of properties we want
to access from controller class
● Controller uses the name of the scope trait as type
parameter of controller or AbstractController class
Scope
trait UserScope extends Scope {
var id: String = js.native
var name: String = js.native
var email: String = js.native
var friends: js.Array[String] = js.native
var delete: js.Function = js.native
}
Controller
@injectable("userDetailsCtrl")
class UserDetailsController(scope: UserScope, http: HttpService)
extends AbstractController[UserScope](scope) {
val future: Future[User] = http.get("/users/john")
Controller with JSExport
@JSExport
@injectable("userDetailsCtrl")
class UserDetailsController(scope: UserScope, http: HttpService)
extends AbstractController[UserScope](scope) {
...
@JSExport
def delete(): Unit = userService.delete(scope.id)
}
<div ng-controller="userDetailsCtrl">
...
<button ng-click="controller.delete()">Delete</button>
</div>
References
● https://github.com/greencatsoft/scalajs-angular
Scal`a`ngular - Scala and Angular

More Related Content

ODP
Introduction to Scala JS
PDF
Logging in Scala
ODP
Drilling the Async Library
PPTX
Alberto Paro - Hands on Scala.js
PDF
Scala.js & friends: SCALA ALL THE THINGS
ODP
Scala's evolving ecosystem- Introduction to Scala.js
PDF
Type-safe front-end development with Scala
PDF
2011-02-03 LA RubyConf Rails3 TDD Workshop
Introduction to Scala JS
Logging in Scala
Drilling the Async Library
Alberto Paro - Hands on Scala.js
Scala.js & friends: SCALA ALL THE THINGS
Scala's evolving ecosystem- Introduction to Scala.js
Type-safe front-end development with Scala
2011-02-03 LA RubyConf Rails3 TDD Workshop

What's hot (20)

ODP
An Introduction to Quill
PDF
Andrea Lattuada, Gabriele Petronella - Building startups on Scala
PDF
Lightbend Lagom: Microservices Just Right (Scala Days 2016 Berlin)
KEY
Introduction to Actor Model and Akka
PDF
How You Convince Your Manager To Adopt Scala.js in Production
PPT
Jasmine - A BDD test framework for JavaScript
PPTX
Developing distributed applications with Akka and Akka Cluster
ODP
2010 07-20 TDD with ActiveResource
PDF
Scala Frameworks for Web Application 2016
PPT
Why scala - executive overview
PPTX
Introduction to Akka - Atlanta Java Users Group
PDF
Intro to JavaScript
PDF
Spring Boot Microservices vs Akka Actor Cluster
PDF
Tomer Elmalem - GraphQL APIs: REST in Peace - Codemotion Milan 2017
PDF
Dart for Java Developers
PPTX
Web Performance & Latest in React
PPTX
Advanced Javascript
PDF
Angular - Chapter 9 - Authentication and Authorization
PPTX
Javascript Best Practices and Intro to Titanium
PDF
Actor Model Akka Framework
An Introduction to Quill
Andrea Lattuada, Gabriele Petronella - Building startups on Scala
Lightbend Lagom: Microservices Just Right (Scala Days 2016 Berlin)
Introduction to Actor Model and Akka
How You Convince Your Manager To Adopt Scala.js in Production
Jasmine - A BDD test framework for JavaScript
Developing distributed applications with Akka and Akka Cluster
2010 07-20 TDD with ActiveResource
Scala Frameworks for Web Application 2016
Why scala - executive overview
Introduction to Akka - Atlanta Java Users Group
Intro to JavaScript
Spring Boot Microservices vs Akka Actor Cluster
Tomer Elmalem - GraphQL APIs: REST in Peace - Codemotion Milan 2017
Dart for Java Developers
Web Performance & Latest in React
Advanced Javascript
Angular - Chapter 9 - Authentication and Authorization
Javascript Best Practices and Intro to Titanium
Actor Model Akka Framework
Ad

Viewers also liked (20)

PDF
Effective Scala (JavaDay Riga 2013)
PPTX
Functional Programming and Concurrency Patterns in Scala
PDF
Effective Scala: Programming Patterns
ODP
Getting Started With AureliaJs
ODP
Akka streams
ODP
Realm Mobile Database - An Introduction
ODP
Mailchimp and Mandrill - The ‘Hominidae’ kingdom
ODP
String interpolation
ODP
Shapeless- Generic programming for Scala
PDF
Kanban
ODP
Introduction to Scala Macros
ODP
Introduction to Java 8
ODP
Mandrill Templates
ODP
Introduction to ScalaZ
ODP
ANTLR4 and its testing
ODP
Functors, Applicatives and Monads In Scala
ODP
Effective way to code in Scala
ODP
Introduction to Knockout Js
ODP
HTML5, CSS, JavaScript Style guide and coding conventions
ODP
Functional programming in Javascript
Effective Scala (JavaDay Riga 2013)
Functional Programming and Concurrency Patterns in Scala
Effective Scala: Programming Patterns
Getting Started With AureliaJs
Akka streams
Realm Mobile Database - An Introduction
Mailchimp and Mandrill - The ‘Hominidae’ kingdom
String interpolation
Shapeless- Generic programming for Scala
Kanban
Introduction to Scala Macros
Introduction to Java 8
Mandrill Templates
Introduction to ScalaZ
ANTLR4 and its testing
Functors, Applicatives and Monads In Scala
Effective way to code in Scala
Introduction to Knockout Js
HTML5, CSS, JavaScript Style guide and coding conventions
Functional programming in Javascript
Ad

Similar to Scal`a`ngular - Scala and Angular (20)

PPTX
Angular js
PPTX
Angular workshop - Full Development Guide
PPTX
Angular js
PDF
AngularJS Basics
PPTX
Angular Framework ppt for beginners and advanced
PDF
AngularJS Workshop
PPTX
Intoduction to Angularjs
PDF
Dependency Injection in Apache Spark Applications
PPTX
AgularJS basics- angular directives and controllers
PDF
Angular.js Primer in Aalto University
PPTX
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
PDF
Introduction to AngularJS
PDF
Angular js - the beginning
PPTX
Understanding angular js
PPT
Angular In Depth
PDF
Workshop 13: AngularJS Parte II
PPT
Coffee@DBG - Exploring Angular JS
PDF
Field injection, type safe configuration, and more new goodies in Declarative...
PPTX
angularJs Workshop
Angular js
Angular workshop - Full Development Guide
Angular js
AngularJS Basics
Angular Framework ppt for beginners and advanced
AngularJS Workshop
Intoduction to Angularjs
Dependency Injection in Apache Spark Applications
AgularJS basics- angular directives and controllers
Angular.js Primer in Aalto University
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
Introduction to AngularJS
Angular js - the beginning
Understanding angular js
Angular In Depth
Workshop 13: AngularJS Parte II
Coffee@DBG - Exploring Angular JS
Field injection, type safe configuration, and more new goodies in Declarative...
angularJs Workshop

More from Knoldus Inc. (20)

PPTX
Angular Hydration Presentation (FrontEnd)
PPTX
Optimizing Test Execution: Heuristic Algorithm for Self-Healing
PPTX
Self-Healing Test Automation Framework - Healenium
PPTX
Kanban Metrics Presentation (Project Management)
PPTX
Java 17 features and implementation.pptx
PPTX
Chaos Mesh Introducing Chaos in Kubernetes
PPTX
GraalVM - A Step Ahead of JVM Presentation
PPTX
Nomad by HashiCorp Presentation (DevOps)
PPTX
Nomad by HashiCorp Presentation (DevOps)
PPTX
DAPR - Distributed Application Runtime Presentation
PPTX
Introduction to Azure Virtual WAN Presentation
PPTX
Introduction to Argo Rollouts Presentation
PPTX
Intro to Azure Container App Presentation
PPTX
Insights Unveiled Test Reporting and Observability Excellence
PPTX
Introduction to Splunk Presentation (DevOps)
PPTX
Code Camp - Data Profiling and Quality Analysis Framework
PPTX
AWS: Messaging Services in AWS Presentation
PPTX
Amazon Cognito: A Primer on Authentication and Authorization
PPTX
ZIO Http A Functional Approach to Scalable and Type-Safe Web Development
PPTX
Managing State & HTTP Requests In Ionic.
Angular Hydration Presentation (FrontEnd)
Optimizing Test Execution: Heuristic Algorithm for Self-Healing
Self-Healing Test Automation Framework - Healenium
Kanban Metrics Presentation (Project Management)
Java 17 features and implementation.pptx
Chaos Mesh Introducing Chaos in Kubernetes
GraalVM - A Step Ahead of JVM Presentation
Nomad by HashiCorp Presentation (DevOps)
Nomad by HashiCorp Presentation (DevOps)
DAPR - Distributed Application Runtime Presentation
Introduction to Azure Virtual WAN Presentation
Introduction to Argo Rollouts Presentation
Intro to Azure Container App Presentation
Insights Unveiled Test Reporting and Observability Excellence
Introduction to Splunk Presentation (DevOps)
Code Camp - Data Profiling and Quality Analysis Framework
AWS: Messaging Services in AWS Presentation
Amazon Cognito: A Primer on Authentication and Authorization
ZIO Http A Functional Approach to Scalable and Type-Safe Web Development
Managing State & HTTP Requests In Ionic.

Recently uploaded (20)

PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
PDF
System and Network Administration Chapter 2
PPTX
ISO 45001 Occupational Health and Safety Management System
DOCX
The Five Best AI Cover Tools in 2025.docx
PPT
Introduction Database Management System for Course Database
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
medical staffing services at VALiNTRY
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
PDF
Best Practices for Rolling Out Competency Management Software.pdf
PPTX
Introduction to Artificial Intelligence
PPTX
Online Work Permit System for Fast Permit Processing
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
PDF
System and Network Administraation Chapter 3
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
System and Network Administration Chapter 2
ISO 45001 Occupational Health and Safety Management System
The Five Best AI Cover Tools in 2025.docx
Introduction Database Management System for Course Database
A REACT POMODORO TIMER WEB APPLICATION.pdf
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
medical staffing services at VALiNTRY
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Best Practices for Rolling Out Competency Management Software.pdf
Introduction to Artificial Intelligence
Online Work Permit System for Fast Permit Processing
Which alternative to Crystal Reports is best for small or large businesses.pdf
The Role of Automation and AI in EHS Management for Data Centers.pdf
System and Network Administraation Chapter 3
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
ManageIQ - Sprint 268 Review - Slide Deck
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...

Scal`a`ngular - Scala and Angular