IAngularJSiAbouttheTutorialAngularJSisaverypowerfulJavaScriptlibrary.
ItisusedinSinglePageApplication(SPA)projects.
ItextendsHTMLDOMwithadditionalattributesandmakesitmoreresponsivetouseractions.
AngularJSisopensource,completelyfree,andusedbythousandsofdevelopersaroundtheworld.
ItislicensedundertheApachelicenseversion2.
0.
AudienceThistutorialisdesignedforsoftwareprofessionalswhowanttolearnthebasicsofAngularJSanditsprogrammingconceptsinsimpleandeasysteps.
ItdescribesthecomponentsofAngularJSwithsuitableexamples.
PrerequisitesYoushouldhaveabasicunderstandingofJavaScriptandanytexteditor.
Aswearegoingtodevelopweb-basedapplicationsusingAngularJS,itwillbegoodifyouhaveanunderstandingofotherwebtechnologiessuchasHTML,CSS,AJAX,etc.
Disclaimer&CopyrightCopyright2014byTutorialsPoint(I)Pvt.
Ltd.
Allthecontentandgraphicspublishedinthise-bookarethepropertyofTutorialsPoint(I)Pvt.
Ltd.
Theuserofthise-bookisprohibitedtoreuse,retain,copy,distributeorrepublishanycontentsorapartofcontentsofthise-bookinanymannerwithoutwrittenconsentofthepublisher.
Westrivetoupdatethecontentsofourwebsiteandtutorialsastimelyandaspreciselyaspossible,however,thecontentsmaycontaininaccuraciesorerrors.
TutorialsPoint(I)Pvt.
Ltd.
providesnoguaranteeregardingtheaccuracy,timelinessorcompletenessofourwebsiteoritscontentsincludingthistutorial.
Ifyoudiscoveranyerrorsonourwebsiteorinthistutorial,pleasenotifyusatcontact@tutorialspoint.
comAngularJSiiTableofContentsAbouttheTutorialiAudienceiPrerequisitesiDisclaimer&CopyrightiTableofContentsii1.
OVERVIEW1GeneralFeatures1CoreFeatures1Concepts2AdvantagesofAngularJS3DisadvantagesofAngularJS4AngularJSDirectives42.
ENVIRONMENT53.
MVCARCHITECTURE9TheModel10TheView10TheController104.
FIRSTAPPLICATION11CreatingAngularJSApplication11ExecutingAngularJSApplication11HowAngularJSIntegrateswithHTML135.
DIRECTIVES14ng-appdirective14ng-initdirective14ng-modeldirective15AngularJSiiing-repeatdirective156.
EXPRESSIONS177.
CONTROLLERS198.
FILTERS22UppercaseFilter22LowercaseFilter22CurrencyFilter22Filter23OrderByFilter239.
TABLES2710.
HTMLDOM31ng-disabledDirective31ng-showDirective31ng-hideDirective31ng-clickDirective3211.
MODULES34ApplicationModule34ControllerModule34UseModules3512.
FORMS39Events39ng-click39ValidateData4013.
INCLUDES4414.
AJAX48AngularJSiv15.
VIEWS52ng-viewDirective52ng-templateDirective52$routeProviderService5316.
SCOPES57ScopeInheritance5717.
SERVICES61UsingFactoryMethod61UsingServiceMethod6118.
DEPENDENCYINJECTION64Value64Factory65Service65Provider66Constant6719.
DIRECTIVES70ng-appdirective70ng-initdirective70ng-modeldirective71ng-repeatdirective7120.
INTERNALIZATION73ExampleUsingDanishLocale73ExampleUsingBrowserLocale74AngularJSvAngularJSisanopen-sourcewebapplicationframework.
Itwasoriginallydevelopedin2009byMiskoHeveryandAdamAbrons.
ItisnowmaintainedbyGoogle.
Itslatestversionis1.
2.
21.
DefinitionofAngularJSasputbyitsofficialdocumentationisasfollows:AngularJSisastructuralframeworkfordynamicwebapplications.
ItletsyouuseHTMLasyourtemplatelanguageandletsyouextendHTML'ssyntaxtoexpressyourapplicationcomponentsclearlyandsuccinctly.
Itsdatabindinganddependencyinjectioneliminatemuchofthecodeyoucurrentlyhavetowrite.
Anditallhappenswithinthebrowser,makingitanidealpartnerwithanyservertechnology.
GeneralFeaturesThegeneralfeaturesofAngularJSareasfollows:AngularJSisaefficientframeworkthatcancreateRichInternetApplications(RIA).
AngularJSprovidesdevelopersanoptionstowriteclientsideapplicationsusingJavaScriptinacleanModelViewController(MVC)way.
ApplicationswritteninAngularJSarecross-browsercompliant.
AngularJSautomaticallyhandlesJavaScriptcodesuitableforeachbrowser.
AngularJSisopensource,completelyfree,andusedbythousandsofdevelopersaroundtheworld.
ItislicensedundertheApachelicenseversion2.
0.
Overall,AngularJSisaframeworktobuildlargescale,high-performance,andeasy-to-maintainwebapplications.
CoreFeaturesThecorefeaturesofAngularJSareasfollows:Data-binding:Itistheautomaticsynchronizationofdatabetweenmodelandviewcomponents.
1.
OVERVIEWAngularJSviScope:Theseareobjectsthatrefertothemodel.
Theyactasagluebetweencontrollerandview.
Controller:TheseareJavaScriptfunctionsboundtoaparticularscope.
Services:AngularJScomeswithseveralbuilt-inservicessuchas$httptomakeaXMLHttpRequests.
Thesearesingletonobjectswhichareinstantiatedonlyonceinapp.
Filters:Theseselectasubsetofitemsfromanarrayandreturnsanewarray.
Directives:DirectivesaremarkersonDOMelementssuchaselements,attributes,css,andmore.
ThesecanbeusedtocreatecustomHTMLtagsthatserveasnew,customwidgets.
AngularJShasbuilt-indirectivessuchasngBind,ngModel,etc.
Templates:Thesearetherenderedviewwithinformationfromthecontrollerandmodel.
Thesecanbeasinglefile(suchasindex.
html)ormultipleviewsinonepageusingpartials.
Routing:Itisconceptofswitchingviews.
ModelViewWhatever:MVWisadesignpatternfordividinganapplicationintodifferentpartscalledModel,View,andController,eachwithdistinctresponsibilities.
AngularJSdoesnotimplementMVCinthetraditionalsense,butrathersomethingclosertoMVVM(Model-View-ViewModel).
TheAngularJSteamrefersithumorouslyasModelViewWhatever.
DeepLinking:DeeplinkingallowstoencodethestateofapplicationintheURLsothatitcanbebookmarked.
TheapplicationcanthenberestoredfromtheURLtothesamestate.
DependencyInjection:AngularJShasabuilt-independencyinjectionsubsystemthathelpsthedevelopertocreate,understand,andtesttheapplicationseasily.
ConceptsThefollowingdiagramdepictssomeimportantpartsofAngularJSwhichwewilldiscussindetailinthesubsequentchapters.
AngularJSviiAdvantagesofAngularJSTheadvantagesofAngularJSare:ItprovidesthecapabilitytocreateSinglePageApplicationinaverycleanandmaintainableway.
ItprovidesdatabindingcapabilitytoHTML.
Thus,itgivesuserarichandresponsiveexperience.
AngularJScodeisunittestable.
AngularJSusesdependencyinjectionandmakeuseofseparationofconcerns.
AngularJSprovidesreusablecomponents.
AngularJSviiiWithAngularJS,thedeveloperscanachievemorefunctionalitywithshortcode.
InAngularJS,viewsarepurehtmlpages,andcontrollerswritteninJavaScriptdothebusinessprocessing.
Onthetopofeverything,AngularJSapplicationscanrunonallmajorbrowsersandsmartphones,includingAndroidandiOSbasedphones/tablets.
DisadvantagesofAngularJSThoughAngularJScomeswithalotofmerits,herearesomepointsofconcern:Notsecure:BeingJavaScriptonlyframework,applicationwritteninAngularJSarenotsafe.
Serversideauthenticationandauthorizationismusttokeepanapplicationsecure.
Notdegradable:IftheuserofyourapplicationdisablesJavaScript,thennothingwouldbevisible,exceptthebasicpage.
AngularJSDirectivesTheAngularJSframeworkcanbedividedintothreemajorparts:ng-app:ThisdirectivedefinesandlinksanAngularJSapplicationtoHTML.
ng-model:ThisdirectivebindsthevaluesofAngularJSapplicationdatatoHTMLinputcontrols.
ng-bind:ThisdirectivebindstheAngularJSapplicationdatatoHTMLtags.
AngularJSixThischapterdescribeshowtosetupAngularJSlibrarytobeusedinwebapplicationdevelopment.
Italsobrieflydescribesthedirectorystructureanditscontents.
Whenyouopenthelinkhttps://angularjs.
org/,youwillseetherearetwooptionstodownloadAngularJSlibrary:ViewonGitHub–Byclickingonthisbutton,youaredivertedtoGitHubandgetallthelatestscripts.
Download–Byclickingonthisbutton,ascreenyougettoseeadialogboxshownas:2.
ENVIRONMENTAngularJSxThisscreenoffersvariousoptionsforselectingAngularJSasfollows:DownloadingandhostingfileslocallyoTherearetwodifferentoptions:LegacyandLatest.
Thenamesthemselvesareself-descriptive.
TheLegacyhasversionlessthan1.
2.
xandtheLatestcomewithversion1.
3.
x.
oWecanalsogowiththeminimized,uncompressed,orzippedversion.
CDNaccess:YoualsohaveaccesstoaCDN.
TheCDNgivesyouaccesstoregionaldatacenters.
Inthiscase,theGooglehost.
TheCDNtransferstheresponsibilityofhostingfilesfromyourownserverstoaseriesofexternalones.
ItalsooffersanadvantagethatifthevisitorofyourwebpagehasalreadydownloadedacopyofAngularJSfromthesameCDN,thereisnoneedtore-downloadit.
WeareusingtheCDNversionsofthelibrarythroughoutthistutorial.
ExampleNowletuswriteasimpleexampleusingAngularJSlibrary.
LetuscreateanHTMLfilemyfirstexample.
htmlshownasbelow:AngularJSxiWelcome{{helloTo.
title}}totheworldofTutorialspoint!
数脉科技(shuhost)8月促销:香港独立服务器,自营BGP、CN2+BGP、阿里云线路,新客立减400港币/月,老用户按照优惠码减免!香港服务器带宽可选10Mbps、30Mbps、50Mbps、100Mbps带宽,支持中文本Windows、Linux等系统。官方网站:https://www.shuhost.com* 更大带宽可在选购时选择同样享受优惠。* 目前仅提供HKBGP、阿里云产品,香港...
diyvm怎么样?diyvm是一家国内成立时间比较久的主机商家了,大约在6年前站长曾经用过他家的美国机房的套餐,非常稳定,适合做站,目前商家正在针对香港沙田机房的VPS进行促销,给的是五折优惠,续费同价,香港沙田机房走的是CN2直连的线路,到大陆地区的速度非常好,DiyVM商家采用小带宽不限流量的形式,带宽2Mbps起步,做站完全够用,有需要的朋友可以入手。diyvm优惠码:五折优惠码:OFF50...
BuyVM在昨天宣布上线了第四个数据中心产品:迈阿密,基于KVM架构的VPS主机,采用AMD Ryzen 3900X CPU,DDR4内存,NVMe硬盘,1Gbps带宽,不限制流量方式,最低$2/月起,支持Linux或者Windows操作系统。这是一家成立于2010年的国外主机商,提供基于KVM架构的VPS产品,数据中心除了新上的迈阿密外还包括美国拉斯维加斯、新泽西和卢森堡等,主机均为1Gbps带...
htmldisabled为你推荐
投资者适当性客户端系统腾讯周鸿祎模块ios8IOJsios8支持ipadeacceleratoreaccelerator.shm_size设置多少合适呢?iphone连不上wifi苹果手机“无法加入网络”怎么办tcpip上的netbios怎么启用TCP/IP上的NetBIOS重庆电信宽带测速重庆电信光纤宽带网络,内外网络和电脑等设备都没发生变化的情况下,办理了从20M提速到100M业务。迅雷快鸟迅雷快鸟这种强盗软件不违规吗?
空间域名 沈阳虚拟主机 GGC 香港加速器 edis 标准机柜尺寸 网通代理服务器 魔兽世界台湾服务器 godaddy域名证书 卡巴斯基官方免费版 徐正曦 泉州电信 百度云加速 starry 免费asp空间申请 wordpress中文主题 atom处理器 免费网络空间 网站加速 杭州电信宽带 更多