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!
IT狗为用户提供 在线ping、在线tcping、在线路由追踪、域名被墙检测、域名被污染检测 等实用工具。【工具地址】https://www.itdog.cn/【工具特色】1、目前同类网站中,在线ping 仅支持1次或少量次数的测试,无法客观的展现目标服务器一段时间的网络状况,IT狗Ping工具可持续的进行一段时间的ping测试,并生成更为直观的网络质量柱状图,让用户更容易掌握服务器在各地区、各线...
cyun怎么样?cyun蓝米数据是一家(香港)藍米數據有限公司旗下品牌,蓝米云、蓝米主机等同属于该公司品牌。CYUN全系列云产品采用KVM架构,SSD磁盘阵列,优化线路,低延迟,高稳定。目前,cyun推出的香港云服务器性价比超高,香港cn2 gia云服务器,1核1G1M/系统盘+20G数据盘,低至29元/月起;香港多ip站群云服务器,16个ip/4核4G仅220元/月起,希望买香港站群服务器的站长...
hostwinds怎么样?2021年7月最新 hostwinds 优惠码整理,Hostwinds 优惠套餐整理,Hostwinds 西雅图机房直连线路 VPS 推荐,目前最低仅需 $4.99 月付,并且可以免费更换 IP 地址。本文分享整理一下最新的 Hostwinds 优惠套餐,包括托管型 VPS、无托管型 VPS、Linux VPS、Windows VPS 等多种套餐。目前 Hostwinds...
htmldisabled为你推荐
设置media支持ipad支持ipad支持ipad支持ipad您的iphone重庆网通中国联通重庆分公司的公司简介canvas2七尾奈留除了DC canvas2 sola EF 快乐小兔幸运草 以外改编成动画的作品有哪些?google中国地图谷歌退出中国,地图要是关了就太可惜了!手机谷歌地图还能用吗?联通iphone4联通iphone4好用吗
腾讯云盘 电影服务器 谷歌香港 150邮箱 100x100头像 web服务器架设 空间论坛 免费防火墙 美国堪萨斯 香港亚马逊 跟踪路由命令 带宽租赁 东莞服务器托管 云服务器比较 空间服务器 稳定空间 google搜索打不开 优惠服务器 alexa搜 赵荣 更多