JavaScript Angular, setting scope variables with two dots

I have a problem when setting scope variables with two dots. See below for my controller and my error.

.controller('CreateSubject', function ($scope, factory, $cookieStore, $location, $rootScope){
    $scope.subject.prerequisit = [];
})

And I get the error:

angular.js:13236 TypeError: Cannot set property 'prerequisit' of undefined at new

Answer:1

The syntax that you have to follow is :

$scope.subject = { prerequisit : [] };
Answer:2

I am currently using 1.5.3 AngularJS Version & ng-include="'file.html'" is not working <!DOCTYPE html> <html lang="en-US" ng-app="myApp"> <head> <!-- Include ...

I am currently using 1.5.3 AngularJS Version & ng-include="'file.html'" is not working <!DOCTYPE html> <html lang="en-US" ng-app="myApp"> <head> <!-- Include ...

I have following model to collect data. <form class="form-login" name="myform" action="transactionsave.php" method="post"> <div class="modal fade" id="...

I have following model to collect data. <form class="form-login" name="myform" action="transactionsave.php" method="post"> <div class="modal fade" id="...

  1. pass data bootstrap modal
  2. pass parameter bootstrap modal
  3. pass to bootstrap modal
  4. passing id to bootstrap modal
  5. passing values to bootstrap modal
  6. passing object to bootstrap modal
  7. passing data to bootstrap modal angularjs
  8. passing data to bootstrap modal angular 2

I have such string: "{{foo}} is {{bar}}" I would like to extract values from {{}}, how I can achieve this? Expected result is ["foo", "bar"] I tried "{{foo}} is {{bar}}".match(/\{\{(.*?)\}\}/g) ...

I have such string: "{{foo}} is {{bar}}" I would like to extract values from {{}}, how I can achieve this? Expected result is ["foo", "bar"] I tried "{{foo}} is {{bar}}".match(/\{\{(.*?)\}\}/g) ...

  1. javascript simple string hash
  2. javascript simple string encryption
  3. javascript simple string replace
  4. javascript simple string search
  5. javascript simple string compression
  6. javascript simple encode string
  7. javascript simple random string
  8. javascript simple encrypt decrypt string
  9. javascript simple quote in string

I have an ordered list of items that I want to be displayed. Getting this done with Angular is trivial: <p>Filter a game: <input type="text" ng-model="search.name" /></p> <game-...

I have an ordered list of items that I want to be displayed. Getting this done with Angular is trivial: <p>Filter a game: <input type="text" ng-model="search.name" /></p> <game-...