AngularJS ngHref Directive

Mayank Agarwal
Updated on 08-Oct-2021 12:11:27

334 Views

The ngHref Directive in AngularJS solves the problem of replacing the markup when the link is broken which thus leads the system to return a 404 error. Instead of using markup like {{hash}} in an href attribute which will change or replace the markup value, we should use the ngHref directive since that link can be broken and thus leads to return a System Error.Syntax..content..Example − ngHref DirectiveCreate a file "ngHref.html" in your Angular project directory and copy-paste the following code snippet.           ngHref Directive                 ... Read More

AngularJS ngSelected Directive

Mayank Agarwal
Updated on 08-Oct-2021 11:59:25

228 Views

The ngSelected Directive in AngularJS sets the selected attribute element on the element to True. We can also write an expression inside the ngSelected with the only condition that it should evaluate to True.This special directive is necessary since interpolation cannot be used inside the selected attribute.Syntax..content..Example − ngSelected DirectiveCreate a file "ngSelected.html" in your Angular project directory and copy-paste the following code snippet.           ngSelected Directive                                    Welcome to Tutorials Point     ... Read More

AngularJS ng-switch Directive

Mayank Agarwal
Updated on 08-Oct-2021 11:48:00

654 Views

The ngSwitch directive in AngularJS conditionally swaps the DOM structure on the template based upon the scope expression. This directive can be used for showing or hiding elements based upon the switch cases.The HTML elements will be displayed only if the expression inside the ngSwitch directive evaluates to True, else it will remain hidden. This directive is supported by all the HTML elements.Syntax Contents... Contents... Contents... Example − ngSwitch DirectiveCreate a file "ngSwitch.html" in your Angular project directory and copy-paste the following code snippet. ... Read More

Sort Triangles Based on Area in C Program

Arnab Chakraborty
Updated on 08-Oct-2021 11:26:27

884 Views

Suppose we have an array of different triangles where triangles[i] = [ai, bi, ci] these are the sides of ith triangle. We shall have to sort the triangles based on their area. The area of a triangle by using sides is: square root of p*(p-a)*(p-b)*(p-c) where p = (a+b+c)/2.So, if the input is like (7, 24, 25), (5, 12, 13), (3, 4, 5), then the output will be (3, 4, 5), (5, 12, 13), (7, 24, 25)To solve this, we will follow these steps −Define triangle object with sides a, b and cDefine a function square(), this will take Triangle ... Read More

Find Sum, Max and Min Using Variadic Functions in C

Arnab Chakraborty
Updated on 08-Oct-2021 11:23:16

2K+ Views

Suppose we want to make some functions that can take multiple arguments, there are no fixed number of arguments. We want to make three functions sum(), max() and min(), they can calculate sum of the numbers, maximum of numbers and minimum of given numbers respectively. Each of these functions will take number of arguments count as their first argument. To define this type of functions we need to use ellipsis (...) three dots into the function argument. To use it we shall have to include stdarg.h header file. This type of function is called variadict functions. To access variable arguments ... Read More

Find Permutations of Given Strings in C

Arnab Chakraborty
Updated on 08-Oct-2021 11:19:50

6K+ Views

Suppose we have few strings in an array. We shall have to find all permutations of them in different line.So, if the input is like strings = ["abc", "def", "ghi"], then the output will beabc def ghi abc ghi def def abc ghi def ghi abc ghi abc def ghi def abcTo solve this, we will follow these steps −Define a function next_permutation(), this will take n, string array s, for initialize i := n - 1, when i > 0, update (decrease i by 1), do:if s[i] > s[i - 1]), then:j := i + 1for j < n, ... Read More

Find Frequency of Each Digit in a String Using C

Arnab Chakraborty
Updated on 08-Oct-2021 11:18:19

5K+ Views

Suppose we have a string s. The s contains letters and digits both. We shall have to find frequencies of each digit and display them. To do this we can make an array of size 10 for each digits (0 through 9), initially all elements are 0 inside the array, then when we encounter a digit simply increase the value of that index and finally print them all.So, if the input is like s = "we85abc586wow236h69", then the output will be (Number 2, Freq 1) (Number 3, Freq 1) (Number 5, Freq 2) (Number 6, Freq 3) (Number 8, Freq ... Read More

Print String Tokens in C

Arnab Chakraborty
Updated on 08-Oct-2021 11:15:09

3K+ Views

Suppose we have a string s that contains a sentence with few words. We shall have to print each word into new lines. To do this we can use the strtok() function under the string.h header file. This function takes the string and a delimiter. Here the delimiter is blank space " ".So, if the input is like s = "Let us see some string tokenizing fun", then the output will beLet us see some string tokenizing funTo solve this, we will follow these steps −token := first word by using strtok(s, " ") here delimiter is " "while token ... Read More

AngularJS isObject Method

Mayank Agarwal
Updated on 08-Oct-2021 11:09:47

684 Views

The isObject() method in AngularJS basically checks if a reference is an Object or not. This method will return True if the reference passed inside the function is an Object, else it will return False.Note − NULL values are not considered as an Object, but JavaScript arrays are objects.Syntaxangular.isObject(value)Example − Check if the reference is an Object or notCreate a file "isObject.html" in your Angular project directory and copy-paste the following code snippet.           angular.isObject()                               ... Read More

Dynamically Create Array and Print Elements Sum in C

Arnab Chakraborty
Updated on 08-Oct-2021 11:09:20

8K+ Views

Suppose we have a number n. We shall have to make an array of size n dynamically and take n numbers one by one, then find the sum. To make the array we can use malloc() or calloc() function which is present inside the stdlib.h header file. The value of n is also provided as input through stdin.So, if the input is like n = 6, and array elements 9, 8, 7, 2, 4, 3, then the output will be 33 because sum of 9 + 8 + 7 + 2 + 4 + 3 = 33.To solve this, we ... Read More

Advertisements