AngularJS 2 Nedir? Bölüm 5
Selamlar, Bugün Angular2’de nasıl server’a bağlanılır ve bir servisden nasıl data çekilir hep beraber inceleyeceğiz. Http işlemlerinin yapılabilmesi için Index.html sayfasına aşağıdaki modullerin eklenmesi gerekmektedir: <script src=”node_modules/angular2/bundles/http.dev.js”></script>
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
<html> <head> <title>AngularJs 2 Öğren</title> <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css"> <link rel="stylesheet" href="app/style.css"> <!-- 1. Load libraries --> <!-- IE required polyfills, in this exact order --> <script src="node_modules/es6-shim/es6-shim.min.js"></script> <script src="node_modules/systemjs/dist/system-polyfills.js"></script> <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="node_modules/rxjs/bundles/Rx.js"></script> <script src="node_modules/angular2/bundles/angular2.dev.js"></script> <script src="node_modules/angular2/bundles/http.dev.js"></script> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> <!-- 2. Configure SystemJS --> <script> System.config({ packages: { app: { format: 'register', defaultExtension: 'js' } } }); System.import('app/boot') .then(null, console.error.bind(console)); </script> </head> <!-- 3. Sayfada Görünecek AngularJS2 Component --> <body> <my-app>Yükleniyor...</my-app> </body> </html> |
Örnek Json servisi için http://jsonplaceholder.typicode.com/ adresinden faydalanılacaktır. Amaç ilgili sevisden...




Son Yorumlar