AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly. Angular's data binding and dependency injection eliminate much of the code you would otherwise have to write.
curly braces whatever so inside here you just write whatever variable so main
heading and check it out
so now let me go ahead and look at that my videos so again that's the very
basics of data binding in other words including class variables inside your
template now just a heads up there are a lot of different kinds of binding in
angular so if you're looking through the documentation in you're like wait a
minute i'm looking at to a binding and the syntax is a little bit different
we're going to talk about how you can bind things differently later on
it's pretty simple but we'll get to that later for now i want to mention this the
number one rule at least my number one rule of software design is never repeat
yourself if you are ever making application or piece of software and you
find yourself doing the same thing over and over again then you're doing it
wrong so a lot of the times especially when you're making a website you have certain bits of code that you include over and over and over again for example the
title of your web page now on my website I have the new boston in almost every
single title so instead of just writing it on every single file and then what if
my website change don't have to go through and do it again
instead what i did is i made this one settings file and it has a setting for
the title now if I ever wanted to update that i would only have to update it in
one location and no update through my entire program now I'm going to show you
guys how to do that in this and since we don't have really any important settings
right now I'm just going to do it with the heading but later on let's say that
you're working with like the twitter api and they gave you a pik key that you
need to use all over or maybe like a file path then you would have that in
your settings file but right now we just put some stupid in here like this right
there so we're going to actually make a new file and go ahead and name it
config service . TS so all of your type square files are going to name or exceed
me and in the TS file extension and for here we're just going to export a class
in we're just going to have variables in here so export class and i'm just going
to name it config basically your configuration settings or the overall
settings for your website so this is going to be variable called main heading
you can actually name it whatever you want
and since this is going to be a constant in other words it's not going to change
before it use the keyword static so this means that this isn't just a normal
variable this is going to be a constant in other words a static not changing so
whenever you're using type script after you make your variable
you have a colon and then you're right what type it is so this is just a string
just gonna have some textin it's not a number or anything like that and now you
just set it equal to anything just like a regular JavaScript variable and just
so i can show you guys that it's different let me change this I'll put my
favorite videos
alright so that's it so now whenever we include this in other files were pretty
much just taking all the variables in here and we can use it somewhere else so
pop back over to apt components that TS and now we actually need to import this
In questa pagina del sito puoi guardare il video online Angular JS Data Binding and Variables della durata di ore minuti seconda in buona qualità , che l'utente ha caricato How To 23 novembre 2016, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 178 volte e gli è piaciuto 1 spettatori. Buona visione!