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!
Megalayer 商家主营业务是以独立服务器和站群服务器的,后来也陆续的有新增香港、菲律宾数据中心的VPS主机产品。由于其线路的丰富,还是深受一些用户喜欢的,有CN2优化直连线路,有全向国际线路,以及针对欧美的国际线路。这次有看到商家也有新增美国机房的VPS主机,也有包括15M带宽CN2优化带宽以及30M带宽的全向线路。Megalayer 商家提供的美国机房VPS产品,提供的配置方案也是比较多,...
ZJI发布了9月份促销信息,针对香港华为云线路物理服务器华为一型提供立减300元优惠码,优惠后香港华为一型月付仅450元起。ZJI是原来Wordpress圈知名主机商家:维翔主机,成立于2011年,2018年9月更名为ZJI,提供中国香港、台湾、日本、美国独立服务器(自营/数据中心直营)租用及VDS、虚拟主机空间、域名注册等业务,商家所选数据中心均为国内访问质量高的机房和线路,比如香港阿里云、华为...
今天遇到一个网友,他之前一直在用阿里云虚拟主机,我们知道虚拟主机绑定域名是直接在面板上绑定的。这里由于他的网站项目流量比较大,虚拟主机是不够的,而且我看他虚拟主机已经有升级过。这里要说的是,用过阿里云虚拟主机的朋友可能会比较一下价格,实际上虚拟主机价格比云服务器还贵。所以,基于成本和性能的考虑,建议他选择云服务器。毕竟他的备案都接入在阿里云。这里在选择阿里云服务器后,他就蒙圈不知道如何绑定域名。这...
htmldisabled为你推荐
标准论文格式范例规范签约xp请仔细阅读在本报告尾部的重要法律声明OPENCORE苹果引导配置说明第四版-基于机动车diandian支持ipad支持ipadoutput_buffering飞飞的官方网站是啥x-routerx-0.4x等于多少?谷歌sbSb是什么意思?
域名投资 汉邦高科域名注册 php主机空间 ddos 息壤主机 42u机柜尺寸 回程路由 tightvnc 电子邮件服务器 中国电信测网速 世界测速 100m独享 免费网页申请 支持外链的相册 Updog 海外空间 架设邮件服务器 英雄联盟台服官网 成都主机托管 开心online 更多