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!
sharktech怎么样?sharktech鲨鱼机房(Sharktech)我们也叫它SK机房,是一家成立于2003年的老牌国外主机商,提供的产品包括独立服务器租用、VPS主机等,自营机房在美国洛杉矶、丹佛、芝加哥和荷兰阿姆斯特丹等,主打高防产品,独立服务器免费提供60Gbps/48Mpps攻击防御。机房提供1-10Gbps带宽不限流量服务器,最低丹佛/荷兰机房每月49美元起,洛杉矶机房最低59美元...
CloudCone针对中国农历新年推出了几款特别套餐, 其中2019年前注册的用户可以以13.5美元/年的价格购买一款1G内存特价套餐,以及另外提供了两款不限制注册时间的用户可购买年付套餐。CloudCone是Quadcone旗下成立于2017年的子品牌,提供VPS及独立服务器租用,也是较早提供按小时计费VPS的商家之一,支持使用PayPal或者支付宝等付款方式。下面列出几款特别套餐配置信息。CP...
对于DMIT商家已经关注有一些时候,看到不少的隔壁朋友们都有分享到,但是这篇还是我第一次分享这个服务商。根据看介绍,DMIT是一家成立于2017年的美国商家,据说是由几位留美学生创立的,数据中心位于香港、伯力G-Core和洛杉矶,主打香港CN2直连云服务器、美国CN2直连云服务器产品。最近看到DMIT商家有对洛杉矶CN2 GIA VPS端口进行了升级,不过价格没有变化,依然是季付28.88美元起。...
htmldisabled为你推荐
ionizationios10中南财经政法大学知识产权研究中心文件127仪器win7支持ipad支持ipad请仔细阅读在本报告尾部的重要法律声明xp如何关闭445端口Windows XP 怎么关闭445端口,我是电脑小白,求各位讲详细点iphone连不上wifi苹果手机“无法加入网络”怎么办phpechophp echo函数 是什么意思
php主机空间 韩国服务器租用 免费动态域名 Dedicated 360抢票助手 win8升级win10正式版 512m内存 云图标 申请空间 好看qq空间 anylink 银盘服务是什么 华为云服务登录 万网主机管理 英雄联盟台服官网 国外代理服务器 广东服务器托管 cdn加速技术 alexa搜 ping值 更多