TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
ng-init Directive In AngularJs
Ajay Malik
Aug 01
2016
Code
551
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
ng-init directive
ng-init directive is used to define default value in AngularJs
Example
<!DOCTYPE html
>
<
html
>
<
script
src
=
"http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"
>
</
script
>
<
body
>
<
div
ng-app
=
""
ng-init
=
"a=1;b=5"
>
<
p
>
Total in dollar: {{ a+ b}}
</
p
>
</
div
>
</
body
>
</
html
>
AngularJS
ng-init Directive