Faizah Pratiwi Faizah Pratiwi - 1 year ago 86
AngularJS Question

Cant read the controller

I've just learned AngularJs. I've try to show a data from controller. but the data not show.
my view :

<!DOCTYPE html>
<title>Belajar AngularJs</title>
<body ng-app="FirstApp">
<div ng-controller="MainController">
{{title}} </br>
{{book.title}} </br>
{{book.author}} </br>

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.min.js"></script>
<script src="js/app.js"></script>
<script src="controllers/MainController.js"></script>
<script type="text/javascript"></script>

my controller :

app controller('MainController',['$scope', function ($scope) {
// body...
$scope.title='Belajar AngularJs';
title: 'Belajar Angularjs Bersama Ciwuk',
author : 'Ciwuk';
price : 'Free'

my model :

var app=angular.module('FirstApp',[]);

the result was like this :

anyone help me please? i'm new in angularJS

Answer Source

You should use app.controller and author : 'Ciwuk',. Use comma not semicolon. Try use console(F12) when error happen.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download