4. What is Angular
• What is a SPA (Gmail, Github, Hotmail, Trello, Facebook)
• JavaScript Framework for building SPA apps
• “Angular is what HTML should have been, if it has been
specifically designed for AJAX apps”
12. Views
• Views = HTML
• Directives are reusable components within the View; They
are similar to jQuery Plugins, but much more than that
• Declarative DSL – controversial and yet powerful
17. Models and Scope
• Model = data = JSON
• Scope is container for model, one scope per controller
• $scope.people = [
{ name: “Person 1”, city: “Sofia” },
{ name: “Person 2”, city: “Moscow” },
{ name: “Person 3”, city: “New York” }
]
18. Services
• Usually no reference to DOM
• Singletons, SRP, Dependency Injection
• How do I do X?
• Server communication, business logic, helpers, modal
dialogs, error handling, sharing data between controllers
19. Service Example
app.factory('myService', function($http, $q) {
return {
getAllItems: function() {
var deferred = $q.defer();
$http.get(“/api/getItems").success(function(data) {
deferred.resolve(data);
}).error(function(){
deferred.reject(“Error Message");
});
return deferred.promise;
}}}
23. Conclusion
• SPA, Data-driven apps, CRUD
• The role of the server-side – HTML vs JSON:
o Don’t send HTML if you end up parsing it client-side to do
some calculations over it
o Don’t send JSON if all you do with it is just put it inside the
DOM
25. Thanks to our Sponsors:
Diamond Sponsor:
Gold Sponsors:
Silver Sponsors:
Technological Partners:
Bronze Partners:
Swag Sponsors:
Media Partners:
Hinweis der Redaktion
Добре дошли на презентацията за AngularJSКазвам се живкоЩе си говорим за Angular – това е един Javascript framework който се появи някъде 2010-та година но една миналата година започна да става популярен.
Има славата на не много лесен за използване фреймурк. затова ще започнем с един hello world – как се сетъпва проект и т.н.
Gmail е по-скоро десктоп приложение отколкото уебсайт.
Колко от вас сте ползвали в реален проект повече от тези фреймуърци сте ползвали.Колегите ми казаха задължително да сложа Batman JS
Сякаш преди 5 години беше по-лесно да се пише javascript
Controller – малка jsфункцияТука това трябва да го разберете щото после ще ви трябва
Някой HTML Purist може би ще каже че да правим такива custom тагове в html е било лоша идея поради тая и тая причина. Но мисля че този пример говори сам за себе си. Пишейки такива custom тагове вие на практика разширявате HTML и можете да си направите Domain Specific Language.